@alexgreensh/token-optimizer 0.0.0-stage → 5.13.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +76 -0
- package/.claude-plugin/plugin.json +21 -0
- package/LICENSE +130 -0
- package/LICENSE-SMALL-BUSINESS.md +62 -0
- package/PRIVACY.md +200 -0
- package/README.md +13 -2
- package/hooks/codex-hooks.json +4 -0
- package/hooks/hooks.json +182 -0
- package/hooks/module_runner.py +149 -0
- package/hooks/posttooluse_runner.py +1110 -0
- package/hooks/python-launcher.sh +816 -0
- package/hooks/run.py +776 -0
- package/hooks/sessionstart_runner.py +629 -0
- package/hooks/stop_runner.py +408 -0
- package/hooks/userpromptsubmit_runner.py +722 -0
- package/hooks/windows-launcher.py +163 -0
- package/install-cloud.sh +23 -0
- package/package.json +29 -4
- package/skills/fleet-auditor/SKILL.md +150 -0
- package/skills/fleet-auditor/references/fleet-systems.md +167 -0
- package/skills/fleet-auditor/references/report-template.md +50 -0
- package/skills/fleet-auditor/references/waste-patterns.md +126 -0
- package/skills/fleet-auditor/scripts/fleet.py +3612 -0
- package/skills/fleet-auditor/scripts/shared.py +277 -0
- package/skills/resume-checkpoint/SKILL.md +52 -0
- package/skills/resume-checkpoint/scripts/pull_checkpoint.py +188 -0
- package/skills/token-coach/SKILL.md +129 -0
- package/skills/token-coach/assets/coach-dashboard-tab.html +45 -0
- package/skills/token-coach/examples/coaching-session-agentic.md +62 -0
- package/skills/token-coach/examples/coaching-session-heavy-setup.md +46 -0
- package/skills/token-coach/examples/coaching-session-new-project.md +38 -0
- package/skills/token-coach/references/agentic-systems.md +147 -0
- package/skills/token-coach/references/coach-patterns.md +120 -0
- package/skills/token-coach/references/coaching-scripts.md +146 -0
- package/skills/token-coach/references/deterministic-stages.md +102 -0
- package/skills/token-coach/references/keepwarm-consent.md +48 -0
- package/skills/token-coach/references/quick-reference.md +155 -0
- package/skills/token-dashboard/SKILL.md +72 -0
- package/skills/token-optimizer/SKILL.md +150 -0
- package/skills/token-optimizer/assets/dashboard.html +7251 -0
- package/skills/token-optimizer/examples/claude-md-optimized.md +40 -0
- package/skills/token-optimizer/examples/hooks-starter.json +179 -0
- package/skills/token-optimizer/examples/permissions-deny-template.json +24 -0
- package/skills/token-optimizer/pricing/prices.json +695 -0
- package/skills/token-optimizer/references/agent-prompts.md +687 -0
- package/skills/token-optimizer/references/cli-reference.md +92 -0
- package/skills/token-optimizer/references/codex-workflow.md +188 -0
- package/skills/token-optimizer/references/cursor-workflow.md +74 -0
- package/skills/token-optimizer/references/error-recovery.md +37 -0
- package/skills/token-optimizer/references/implementation-playbook.md +416 -0
- package/skills/token-optimizer/references/keepwarm-consent.md +48 -0
- package/skills/token-optimizer/references/opencode-workflow.md +72 -0
- package/skills/token-optimizer/references/optimization-checklist.md +714 -0
- package/skills/token-optimizer/references/phase0-setup.md +142 -0
- package/skills/token-optimizer/references/presentation-workflow.md +72 -0
- package/skills/token-optimizer/references/session-continuity.md +19 -0
- package/skills/token-optimizer/references/token-flow-architecture.md +629 -0
- package/skills/token-optimizer/scripts/activity_tracker.py +143 -0
- package/skills/token-optimizer/scripts/antigravity_doctor.py +548 -0
- package/skills/token-optimizer/scripts/antigravity_hook_bridge.py +511 -0
- package/skills/token-optimizer/scripts/antigravity_install.py +376 -0
- package/skills/token-optimizer/scripts/antigravity_proto.py +413 -0
- package/skills/token-optimizer/scripts/antigravity_session.py +346 -0
- package/skills/token-optimizer/scripts/antigravity_state.py +486 -0
- package/skills/token-optimizer/scripts/archive_result.py +1725 -0
- package/skills/token-optimizer/scripts/bash_compress.py +2490 -0
- package/skills/token-optimizer/scripts/bash_compress_hook.py +766 -0
- package/skills/token-optimizer/scripts/bash_hook.py +61 -0
- package/skills/token-optimizer/scripts/bash_whitelist.py +243 -0
- package/skills/token-optimizer/scripts/benchmark.py +1765 -0
- package/skills/token-optimizer/scripts/build_output_compress.py +776 -0
- package/skills/token-optimizer/scripts/cloud_kit.py +991 -0
- package/skills/token-optimizer/scripts/codex_command_compress.py +434 -0
- package/skills/token-optimizer/scripts/codex_compact_prompt.py +273 -0
- package/skills/token-optimizer/scripts/codex_doctor.py +454 -0
- package/skills/token-optimizer/scripts/codex_hook_bridge.py +311 -0
- package/skills/token-optimizer/scripts/codex_install.py +810 -0
- package/skills/token-optimizer/scripts/codex_io.py +119 -0
- package/skills/token-optimizer/scripts/codex_log_index.py +219 -0
- package/skills/token-optimizer/scripts/codex_models.py +34 -0
- package/skills/token-optimizer/scripts/codex_session.py +1186 -0
- package/skills/token-optimizer/scripts/codex_state.py +707 -0
- package/skills/token-optimizer/scripts/codex_statusline.py +303 -0
- package/skills/token-optimizer/scripts/command_filters.py +386 -0
- package/skills/token-optimizer/scripts/compression_backfill.py +600 -0
- package/skills/token-optimizer/scripts/compression_log.py +230 -0
- package/skills/token-optimizer/scripts/context_intel.py +331 -0
- package/skills/token-optimizer/scripts/context_pressure.py +115 -0
- package/skills/token-optimizer/scripts/copilot_doctor.py +406 -0
- package/skills/token-optimizer/scripts/copilot_hook_bridge.py +709 -0
- package/skills/token-optimizer/scripts/copilot_install.py +277 -0
- package/skills/token-optimizer/scripts/copilot_session.py +496 -0
- package/skills/token-optimizer/scripts/copilot_state.py +569 -0
- package/skills/token-optimizer/scripts/copilot_vscode.py +832 -0
- package/skills/token-optimizer/scripts/cowork_doctor.py +270 -0
- package/skills/token-optimizer/scripts/cowork_install.py +380 -0
- package/skills/token-optimizer/scripts/credential_patterns.py +1514 -0
- package/skills/token-optimizer/scripts/cursor_doctor.py +602 -0
- package/skills/token-optimizer/scripts/cursor_hook_bridge.py +843 -0
- package/skills/token-optimizer/scripts/cursor_install.py +423 -0
- package/skills/token-optimizer/scripts/cursor_session.py +303 -0
- package/skills/token-optimizer/scripts/cursor_state.py +348 -0
- package/skills/token-optimizer/scripts/delta_diff.py +110 -0
- package/skills/token-optimizer/scripts/detectors/__init__.py +2 -0
- package/skills/token-optimizer/scripts/detectors/bad_decomposition.py +78 -0
- package/skills/token-optimizer/scripts/detectors/cache_instability.py +504 -0
- package/skills/token-optimizer/scripts/detectors/looping.py +88 -0
- package/skills/token-optimizer/scripts/detectors/output_waste.py +143 -0
- package/skills/token-optimizer/scripts/detectors/overpowered.py +116 -0
- package/skills/token-optimizer/scripts/detectors/pdf_ingestion.py +52 -0
- package/skills/token-optimizer/scripts/detectors/registry.py +65 -0
- package/skills/token-optimizer/scripts/detectors/respond_to_bash.py +76 -0
- package/skills/token-optimizer/scripts/detectors/retry_churn.py +83 -0
- package/skills/token-optimizer/scripts/detectors/tool_cascade.py +62 -0
- package/skills/token-optimizer/scripts/detectors/wasteful_thinking.py +75 -0
- package/skills/token-optimizer/scripts/detectors/weak_model.py +55 -0
- package/skills/token-optimizer/scripts/detectors/websearch_routing.py +72 -0
- package/skills/token-optimizer/scripts/deterministic_candidates.py +1458 -0
- package/skills/token-optimizer/scripts/devin_compress.py +790 -0
- package/skills/token-optimizer/scripts/devin_doctor.py +403 -0
- package/skills/token-optimizer/scripts/devin_hooks.py +453 -0
- package/skills/token-optimizer/scripts/devin_install.py +1086 -0
- package/skills/token-optimizer/scripts/devin_source.py +119 -0
- package/skills/token-optimizer/scripts/devin_state.py +330 -0
- package/skills/token-optimizer/scripts/devin_verify.py +67 -0
- package/skills/token-optimizer/scripts/grok_doctor.py +560 -0
- package/skills/token-optimizer/scripts/grok_hook_bridge.py +699 -0
- package/skills/token-optimizer/scripts/grok_install.py +397 -0
- package/skills/token-optimizer/scripts/grok_session.py +317 -0
- package/skills/token-optimizer/scripts/grok_state.py +299 -0
- package/skills/token-optimizer/scripts/hermes_doctor.py +479 -0
- package/skills/token-optimizer/scripts/hermes_hook_bridge.py +285 -0
- package/skills/token-optimizer/scripts/hermes_install.py +668 -0
- package/skills/token-optimizer/scripts/hermes_session.py +691 -0
- package/skills/token-optimizer/scripts/hermes_state.py +448 -0
- package/skills/token-optimizer/scripts/hook_io.py +120 -0
- package/skills/token-optimizer/scripts/hook_runtime.py +713 -0
- package/skills/token-optimizer/scripts/injection.py +156 -0
- package/skills/token-optimizer/scripts/install_reconcile.py +952 -0
- package/skills/token-optimizer/scripts/measure.py +58739 -0
- package/skills/token-optimizer/scripts/outline.py +53 -0
- package/skills/token-optimizer/scripts/pipeline_analyzer.py +723 -0
- package/skills/token-optimizer/scripts/plugin_env.py +562 -0
- package/skills/token-optimizer/scripts/py_trust.py +80 -0
- package/skills/token-optimizer/scripts/quality_cache_gate.py +320 -0
- package/skills/token-optimizer/scripts/read_cache.py +2489 -0
- package/skills/token-optimizer/scripts/recovery_output.py +110 -0
- package/skills/token-optimizer/scripts/refetch_fingerprint.py +236 -0
- package/skills/token-optimizer/scripts/refetch_guard.py +244 -0
- package/skills/token-optimizer/scripts/routing_advisor.py +389 -0
- package/skills/token-optimizer/scripts/runtime_env.py +1893 -0
- package/skills/token-optimizer/scripts/session_store.py +979 -0
- package/skills/token-optimizer/scripts/spawn_utils.py +122 -0
- package/skills/token-optimizer/scripts/statusline.js +660 -0
- package/skills/token-optimizer/scripts/structure_map.py +2880 -0
- package/skills/token-optimizer/scripts/structure_map_ts.py +676 -0
- package/skills/token-optimizer/scripts/structure_replay.py +1556 -0
- package/skills/token-optimizer/scripts/thrash_guard.py +604 -0
- package/skills/token-optimizer/scripts/token_estimate.py +80 -0
- package/skills/token-optimizer/scripts/tool_search_diagnostic.py +61 -0
- package/skills/token-optimizer/scripts/utf8_io.py +219 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
|
|
3
|
+
"name": "alexgreensh-token-optimizer",
|
|
4
|
+
"owner": {
|
|
5
|
+
"name": "Alex Greenshpun",
|
|
6
|
+
"email": "alexgreensh@users.noreply.github.com"
|
|
7
|
+
},
|
|
8
|
+
"metadata": {
|
|
9
|
+
"description": "Token optimization tools for Claude Code"
|
|
10
|
+
},
|
|
11
|
+
"plugins": [
|
|
12
|
+
{
|
|
13
|
+
"name": "token-optimizer",
|
|
14
|
+
"source": "./",
|
|
15
|
+
"description": "Audit, fix, and monitor Claude Code context window usage. Find the ghost tokens.",
|
|
16
|
+
"version": "5.13.50",
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "Alex Greenshpun",
|
|
19
|
+
"url": "https://linkedin.com/in/alexgreensh"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/alexgreensh/token-optimizer",
|
|
22
|
+
"repository": "https://github.com/alexgreensh/token-optimizer",
|
|
23
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"token",
|
|
26
|
+
"optimization",
|
|
27
|
+
"context",
|
|
28
|
+
"audit",
|
|
29
|
+
"cost",
|
|
30
|
+
"coach"
|
|
31
|
+
],
|
|
32
|
+
"category": "productivity"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "to-hook-probe",
|
|
36
|
+
"source": "./cowork/to-hook-probe",
|
|
37
|
+
"description": "[BETA] Token Optimizer Cowork hook-firing diagnostic. Install this FIRST in Claude Cowork to see which hooks actually fire on your build. Writes a marker + env dump you can read in-session. Part of the beta Cowork adapter.",
|
|
38
|
+
"version": "0.1.0",
|
|
39
|
+
"author": {
|
|
40
|
+
"name": "Alex Greenshpun",
|
|
41
|
+
"url": "https://linkedin.com/in/alexgreensh"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/alexgreensh/token-optimizer",
|
|
44
|
+
"repository": "https://github.com/alexgreensh/token-optimizer",
|
|
45
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
46
|
+
"keywords": [
|
|
47
|
+
"cowork",
|
|
48
|
+
"beta",
|
|
49
|
+
"diagnostic",
|
|
50
|
+
"hooks"
|
|
51
|
+
],
|
|
52
|
+
"category": "productivity"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "token-optimizer-cowork",
|
|
56
|
+
"source": "./cowork/token-optimizer",
|
|
57
|
+
"description": "Token Optimizer for Claude Cowork \u2014 full skills + Cowork-native hooks (beta). Install THIS in Cowork; the standard token-optimizer entry is for desktop Claude Code.",
|
|
58
|
+
"version": "5.13.50",
|
|
59
|
+
"author": {
|
|
60
|
+
"name": "Alex Greenshpun",
|
|
61
|
+
"url": "https://linkedin.com/in/alexgreensh"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/alexgreensh/token-optimizer",
|
|
64
|
+
"repository": "https://github.com/alexgreensh/token-optimizer",
|
|
65
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
66
|
+
"keywords": [
|
|
67
|
+
"token",
|
|
68
|
+
"optimization",
|
|
69
|
+
"context",
|
|
70
|
+
"cowork",
|
|
71
|
+
"beta"
|
|
72
|
+
],
|
|
73
|
+
"category": "productivity"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "token-optimizer",
|
|
3
|
+
"description": "Audit, fix, and monitor Claude Code context window usage. Find the ghost tokens.",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Alex Greenshpun",
|
|
6
|
+
"url": "https://linkedin.com/in/alexgreensh"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/alexgreensh/token-optimizer",
|
|
9
|
+
"repository": "https://github.com/alexgreensh/token-optimizer",
|
|
10
|
+
"version": "5.13.50",
|
|
11
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"token",
|
|
14
|
+
"optimization",
|
|
15
|
+
"context",
|
|
16
|
+
"audit",
|
|
17
|
+
"cost",
|
|
18
|
+
"coach"
|
|
19
|
+
],
|
|
20
|
+
"types": "./desktop/token-optimizer-desktop/types/index.d.ts"
|
|
21
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Copyright (C) 2026 Alex Greenshpun
|
|
2
|
+
|
|
3
|
+
Required Notice: Copyright Alex Greenshpun (https://linkedin.com/in/alexgreensh)
|
|
4
|
+
|
|
5
|
+
Additional permission (small business): see LICENSE-SMALL-BUSINESS.md
|
|
6
|
+
|
|
7
|
+
# PolyForm Noncommercial License 1.0.0
|
|
8
|
+
|
|
9
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
10
|
+
|
|
11
|
+
## Acceptance
|
|
12
|
+
|
|
13
|
+
In order to get any license under these terms, you must agree to them
|
|
14
|
+
as both strict obligations and conditions to all your licenses.
|
|
15
|
+
|
|
16
|
+
## Copyright License
|
|
17
|
+
|
|
18
|
+
The licensor grants you a copyright license for the software to do
|
|
19
|
+
everything you might do with the software that would otherwise infringe
|
|
20
|
+
the licensor's copyright in it for any permitted purpose. However, you
|
|
21
|
+
may only distribute the software according to Distribution License and
|
|
22
|
+
make changes or new works based on the software according to Changes and
|
|
23
|
+
New Works License.
|
|
24
|
+
|
|
25
|
+
## Distribution License
|
|
26
|
+
|
|
27
|
+
The licensor grants you an additional copyright license to distribute
|
|
28
|
+
copies of the software. Your license to distribute covers distributing
|
|
29
|
+
the software with changes and new works permitted by Changes and New
|
|
30
|
+
Works License.
|
|
31
|
+
|
|
32
|
+
## Notices
|
|
33
|
+
|
|
34
|
+
You must ensure that anyone who gets a copy of any part of the software
|
|
35
|
+
from you also gets a copy of these terms or the URL for them above, as
|
|
36
|
+
well as copies of any plain-text lines beginning with `Required Notice:`
|
|
37
|
+
that the licensor provided with the software.
|
|
38
|
+
|
|
39
|
+
## Changes and New Works License
|
|
40
|
+
|
|
41
|
+
The licensor grants you an additional copyright license to make changes
|
|
42
|
+
and new works based on the software for any permitted purpose.
|
|
43
|
+
|
|
44
|
+
## Patent License
|
|
45
|
+
|
|
46
|
+
The licensor grants you a patent license for the software that covers
|
|
47
|
+
patent claims the licensor can license, or becomes able to license, that
|
|
48
|
+
you would infringe by using the software.
|
|
49
|
+
|
|
50
|
+
## Noncommercial Purposes
|
|
51
|
+
|
|
52
|
+
Any noncommercial purpose is a permitted purpose.
|
|
53
|
+
|
|
54
|
+
## Personal Uses
|
|
55
|
+
|
|
56
|
+
Personal use for research, experiment, and testing for the benefit of
|
|
57
|
+
public knowledge, personal study, private entertainment, hobby projects,
|
|
58
|
+
amateur pursuits, or religious observance, without any anticipated
|
|
59
|
+
commercial application, is use for a permitted purpose.
|
|
60
|
+
|
|
61
|
+
## Noncommercial Organizations
|
|
62
|
+
|
|
63
|
+
Use by any charitable organization, educational institution, public
|
|
64
|
+
research organization, public safety or health organization,
|
|
65
|
+
environmental protection organization, or government institution is use
|
|
66
|
+
for a permitted purpose regardless of the source of funding or
|
|
67
|
+
obligations resulting from the funding.
|
|
68
|
+
|
|
69
|
+
## Fair Use
|
|
70
|
+
|
|
71
|
+
You may have "fair use" rights for the software under the law. These
|
|
72
|
+
terms do not limit them.
|
|
73
|
+
|
|
74
|
+
## No Other Rights
|
|
75
|
+
|
|
76
|
+
These terms do not allow you to sublicense or transfer any of your
|
|
77
|
+
licenses to anyone else, or prevent the licensor from granting licenses
|
|
78
|
+
to anyone else. These terms do not imply any other licenses.
|
|
79
|
+
|
|
80
|
+
## Patent Defense
|
|
81
|
+
|
|
82
|
+
If you make any written claim that the software infringes or contributes
|
|
83
|
+
to infringement of any patent, your patent license for the software
|
|
84
|
+
granted under these terms ends immediately. If your company makes such a
|
|
85
|
+
claim, your patent license ends immediately for work on behalf of your
|
|
86
|
+
company.
|
|
87
|
+
|
|
88
|
+
## Violations
|
|
89
|
+
|
|
90
|
+
The first time you are notified in writing that you have violated any of
|
|
91
|
+
these terms, or done anything with the software not covered by your
|
|
92
|
+
licenses, your licenses can nonetheless continue if you come into full
|
|
93
|
+
compliance with these terms, and take practical steps to correct past
|
|
94
|
+
violations, within 32 days of receiving notice. Otherwise, all your
|
|
95
|
+
licenses end immediately.
|
|
96
|
+
|
|
97
|
+
## No Liability
|
|
98
|
+
|
|
99
|
+
As far as the law allows, the software comes as is, without any warranty
|
|
100
|
+
or condition, and the licensor will not be liable to you for any damages
|
|
101
|
+
arising out of these terms or the use or nature of the software, under
|
|
102
|
+
any kind of legal claim.
|
|
103
|
+
|
|
104
|
+
## Definitions
|
|
105
|
+
|
|
106
|
+
The **licensor** is the individual or entity offering these terms, and
|
|
107
|
+
the **software** is the software the licensor makes available under
|
|
108
|
+
these terms.
|
|
109
|
+
|
|
110
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
111
|
+
|
|
112
|
+
**Your company** is any legal entity, sole proprietorship, or other kind
|
|
113
|
+
of organization that you work for, plus all organizations that have
|
|
114
|
+
control over, are under the control of, or are under common control with
|
|
115
|
+
that organization. **Control** means ownership of substantially all the
|
|
116
|
+
assets of an entity, or the power to direct its management and policies
|
|
117
|
+
by vote, contract, or otherwise. Control can be direct or indirect.
|
|
118
|
+
|
|
119
|
+
**Your licenses** are all the licenses granted to you for the software
|
|
120
|
+
under these terms.
|
|
121
|
+
|
|
122
|
+
**Use** means anything you do with the software requiring one of your
|
|
123
|
+
licenses.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Commercial Licensing
|
|
128
|
+
|
|
129
|
+
For commercial use, please contact Alex Greenshpun:
|
|
130
|
+
me@alexgreenshpun.com | https://linkedin.com/in/alexgreensh
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Token Optimizer Small Business Permission
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2026 Alex Greenshpun
|
|
4
|
+
|
|
5
|
+
Token Optimizer is licensed under the PolyForm Noncommercial License 1.0.0 (see `LICENSE`). In addition
|
|
6
|
+
to the permissions in that license, the licensor grants the permission below. Everything not changed
|
|
7
|
+
here stays governed by `LICENSE`, including its patent, notice, violation, and no-liability terms.
|
|
8
|
+
|
|
9
|
+
## Definitions
|
|
10
|
+
|
|
11
|
+
**Your organization** is the company or other legal entity you use the software for, together with
|
|
12
|
+
every entity that controls it, is controlled by it, or is under common control with it.
|
|
13
|
+
|
|
14
|
+
**People** means everyone working for your organization: employees, individual contractors, and
|
|
15
|
+
founders or owners who work in the business. Count all of them, not only the people who use the software.
|
|
16
|
+
|
|
17
|
+
**Revenue** means your organization's total gross revenue from all sources, averaged per month over the
|
|
18
|
+
previous 12 months (or since founding, if your organization is younger than 12 months).
|
|
19
|
+
|
|
20
|
+
## Small business permission
|
|
21
|
+
|
|
22
|
+
If your organization has **fewer than 5 people AND revenue under US$20,000 per month**, you may use the
|
|
23
|
+
software for your organization's own internal business purposes, at no cost, under the same terms and
|
|
24
|
+
conditions as `LICENSE`.
|
|
25
|
+
|
|
26
|
+
Both conditions must be true at the time of use. A small team inside a larger organization does not
|
|
27
|
+
qualify, even if only a few people use the software.
|
|
28
|
+
|
|
29
|
+
## What this permission does not cover
|
|
30
|
+
|
|
31
|
+
This permission does not allow you to:
|
|
32
|
+
|
|
33
|
+
- sell, sublicense, or distribute the software, or include it in a product or service you provide to others;
|
|
34
|
+
- operate the software as a hosted, managed, or shared service for anyone outside your organization;
|
|
35
|
+
- qualify by dividing an organization, or its work, among separate entities or arrangements to stay under
|
|
36
|
+
the limits.
|
|
37
|
+
|
|
38
|
+
Any of these requires a commercial license.
|
|
39
|
+
|
|
40
|
+
## Your responsibility
|
|
41
|
+
|
|
42
|
+
You are responsible for determining whether your organization qualifies. If the licensor asks, you agree
|
|
43
|
+
to confirm in writing that your organization meets the conditions above.
|
|
44
|
+
|
|
45
|
+
## If you stop qualifying
|
|
46
|
+
|
|
47
|
+
If your organization stops meeting the conditions above, this permission continues for 32 days. After
|
|
48
|
+
that, continued commercial use requires a commercial license.
|
|
49
|
+
|
|
50
|
+
## Changes
|
|
51
|
+
|
|
52
|
+
The licensor may change or withdraw this permission for future releases of the software. A change does
|
|
53
|
+
not take away this permission for a release you obtained while it applied, as long as you keep meeting
|
|
54
|
+
its conditions. If your license under `LICENSE` ends, this permission ends with it.
|
|
55
|
+
|
|
56
|
+
## Written grant
|
|
57
|
+
|
|
58
|
+
This document is the written grant of this permission. No separate confirmation is needed to rely on it.
|
|
59
|
+
|
|
60
|
+
## Commercial licenses
|
|
61
|
+
|
|
62
|
+
For any use outside this permission, contact Alex Greenshpun at me@alexgreenshpun.com.
|
package/PRIVACY.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Privacy Policy
|
|
2
|
+
|
|
3
|
+
**Token Optimizer** is a source-available developer tool that runs entirely on your local machine. It optimizes AI coding assistant context windows across Claude Code, Codex, OpenClaw, OpenCode, Hermes, and Google Antigravity.
|
|
4
|
+
|
|
5
|
+
## No External Data Transmission
|
|
6
|
+
|
|
7
|
+
- **No telemetry**: No usage data, analytics, or metrics are sent anywhere.
|
|
8
|
+
- **No runtime network calls**: Zero outbound network requests during normal operation. The only network activity at runtime is a loopback-only (127.0.0.1) dashboard server for local visualization. Install and update checks contact GitHub (`api.github.com`) to verify release integrity; no product data is sent.
|
|
9
|
+
- **No third-party services**: No external APIs, tracking pixels, or data processors.
|
|
10
|
+
- **No accounts required**: No sign-up, login, or registration.
|
|
11
|
+
|
|
12
|
+
## What Token Optimizer Reads
|
|
13
|
+
|
|
14
|
+
To perform its analysis, Token Optimizer reads files that already exist on your machine:
|
|
15
|
+
|
|
16
|
+
- Host platform session transcripts (JSONL files under `~/.claude/projects/`)
|
|
17
|
+
- `~/.claude/settings.json` and project-level `.claude/settings.json`
|
|
18
|
+
- `~/.claude/CLAUDE.md`, project-level `CLAUDE.md`, and `~/.claude/MEMORY.md`
|
|
19
|
+
- Skill and command directories under `~/.claude/`
|
|
20
|
+
- MCP server configurations
|
|
21
|
+
- Google Antigravity's `~/.gemini/{antigravity-cli,antigravity,antigravity-ide}/`
|
|
22
|
+
conversation stores: only `gen_metadata.data`, `steps.step_type` and step
|
|
23
|
+
timestamps, and a fixed set of summaries columns (`title`, `workspace_uris`,
|
|
24
|
+
`killed`, `not_fully_idle`, `last_modified_time`, `nesting_depth`). Prompt
|
|
25
|
+
text (`history.jsonl` `display`, summaries `preview`), tool arguments in step
|
|
26
|
+
metadata, and `trajectory_metadata_blob` are never read or stored.
|
|
27
|
+
|
|
28
|
+
These files are read locally and never transmitted.
|
|
29
|
+
|
|
30
|
+
## What Token Optimizer Stores
|
|
31
|
+
|
|
32
|
+
Token Optimizer writes several local data stores. On macOS and Linux, all are stored with restrictive file permissions (`0o700` directories, `0o600` files). On Windows, Python cannot apply these POSIX modes (`os.chmod` only toggles the read-only flag), so the stores inherit the access rules of your user profile folder, which by default grants access only to your account, Administrators, and SYSTEM.
|
|
33
|
+
|
|
34
|
+
### Session Metrics Database (trends.db)
|
|
35
|
+
|
|
36
|
+
SQLite database containing per-session aggregates: token counts, model usage, cost estimates, session UUIDs, JSONL file paths. Used for the dashboard and savings tracking.
|
|
37
|
+
|
|
38
|
+
- **Path:** `<plugin-data>/data/trends.db`
|
|
39
|
+
- **Retention:** Configurable via `TOKEN_OPTIMIZER_TRENDS_RETENTION_DAYS` (default: unlimited)
|
|
40
|
+
- **Sensitive content:** Contains JSONL file paths which embed the local username as a path component
|
|
41
|
+
|
|
42
|
+
### Per-Session File Cache (session stores)
|
|
43
|
+
|
|
44
|
+
SQLite databases with file read records, content hashes, token estimates, and cached file content (up to 50KB per file). **Cached content is credential-redacted before storage** using 23 pattern types (AWS keys, API tokens, URL query/fragment auth params, etc.).
|
|
45
|
+
|
|
46
|
+
- **Path:** `<plugin-data>/data/session-store/<session-id>.db`
|
|
47
|
+
- **Retention:** Auto-deleted after 48 hours
|
|
48
|
+
- **Sensitive content:** Cached source code content (credential-redacted). Activity log with tool call summaries.
|
|
49
|
+
|
|
50
|
+
### Checkpoints
|
|
51
|
+
|
|
52
|
+
Markdown files containing truncated conversation context for session continuity. Each checkpoint includes up to 300 characters of the last user message and last assistant message, extracted file paths, decision text, error snippets (up to 150 characters), and todo items.
|
|
53
|
+
|
|
54
|
+
- **Path:** `~/.claude/token-optimizer/checkpoints/`
|
|
55
|
+
- **Retention:** Configurable via `TOKEN_OPTIMIZER_CHECKPOINT_RETENTION_DAYS` (default: 7 days) `TOKEN_OPTIMIZER_CHECKPOINT_PER_SESSION` (default: 5 per session) and `TOKEN_OPTIMIZER_CHECKPOINT_RETENTION_MAX` (default: 400 files in total)
|
|
56
|
+
- **Sensitive content:** Truncated conversation snippets may contain PII or sensitive information the user typed into the coding assistant
|
|
57
|
+
|
|
58
|
+
### Tool Archives
|
|
59
|
+
|
|
60
|
+
JSON files containing the full output of large tool calls (over 4KB), used for retrieval during the same session. **Content is credential-redacted before storage.**
|
|
61
|
+
|
|
62
|
+
- **Path:** `<plugin-data>/data/tool-archive/<session-id>/`
|
|
63
|
+
- **Retention:** Configurable via `TOKEN_OPTIMIZER_ARCHIVE_RETENTION_HOURS` (default: 24 hours), with aggregate caps of 1,000 files and 100 MiB
|
|
64
|
+
- **Sensitive content:** Tool output (credential-redacted) which may include file contents, command output, or API responses
|
|
65
|
+
|
|
66
|
+
### Quality Cache
|
|
67
|
+
|
|
68
|
+
JSON files with per-session quality score snapshots (6-signal metric).
|
|
69
|
+
|
|
70
|
+
- **Path:** `~/.claude/token-optimizer/quality-cache-*.json`
|
|
71
|
+
- **Retention:** Configurable via `TOKEN_OPTIMIZER_QUALITY_CACHE_RETENTION_DAYS` (default: 7 days)
|
|
72
|
+
- **Sensitive content:** None
|
|
73
|
+
|
|
74
|
+
### Configuration and Auxiliary Files
|
|
75
|
+
|
|
76
|
+
- **Config:** `~/.claude/token-optimizer/config.json` (feature flags, consent status, timestamps)
|
|
77
|
+
- **Checkpoint event log:** `~/.claude/token-optimizer/checkpoint-events.jsonl` (rotated at 1000 entries)
|
|
78
|
+
- **Live fill cache:** `~/.claude/token-optimizer/live-fill.json`
|
|
79
|
+
- **Dashboard:** `<plugin-data>/data/dashboard.html` (generated visualization)
|
|
80
|
+
- **Daemon token:** `<plugin-data>/data/daemon-token` (32-byte random secret, 0600 permissions on macOS and Linux)
|
|
81
|
+
- **Daemon logs:** `<plugin-data>/data/logs/` (stdout/stderr from dashboard server)
|
|
82
|
+
|
|
83
|
+
### Antigravity adapter data
|
|
84
|
+
|
|
85
|
+
The Google Antigravity adapter keeps its own minimal state under
|
|
86
|
+
`~/.gemini/token-optimizer/`:
|
|
87
|
+
|
|
88
|
+
- **Consent record:** `config.json` with the `antigravity_consent` flag (R20)
|
|
89
|
+
- **Continuity restore:** `restore-context.md`, a capped summary of the most
|
|
90
|
+
recent session (model, token totals, and — title/workspace permitting — a
|
|
91
|
+
200-character topic and workspace path). Titles and workspace paths originate
|
|
92
|
+
from Antigravity's own summaries and are filtered to printable characters
|
|
93
|
+
before this file is written.
|
|
94
|
+
|
|
95
|
+
The installed plugin payload lives at `~/.gemini/config/plugins/token-optimizer/`
|
|
96
|
+
and is removed by `antigravity-uninstall`.
|
|
97
|
+
|
|
98
|
+
## Credential Handling
|
|
99
|
+
|
|
100
|
+
Token Optimizer scans for 28 credential patterns (AWS keys, API tokens, GitHub PATs, database URIs, JWTs, PEM keys, URL query/fragment auth params, and more) and replaces them with `[CREDENTIAL REDACTED: <type>]` before writing to the session store and tool archive. This redaction is one-way and permanent in stored content.
|
|
101
|
+
|
|
102
|
+
**Known tradeoff:** Credential redaction in the read cache means delta reads against files containing credentials will produce non-empty diffs on every re-read (the stored version has the redacted placeholder, the live file has the actual credential). This is a deliberate security-over-efficiency tradeoff.
|
|
103
|
+
|
|
104
|
+
Bash compression output preserves credential-containing lines verbatim (not redacted) to ensure compressed output returned to the coding assistant doesn't mangle secrets.
|
|
105
|
+
|
|
106
|
+
### Custom redaction patterns
|
|
107
|
+
|
|
108
|
+
You can add your own secret shapes (internal API keys, service tokens, record identifiers) to the built-in list without editing code. Put them in `~/.claude/token-optimizer/redact-patterns.json` (on other platforms, `token-optimizer/redact-patterns.json` under that platform's home, e.g. `~/.codex/`), or set `TOKEN_OPTIMIZER_REDACT_PATTERNS_FILE` to the path of the file, either in your environment or in the `env` block of your global `settings.json` (`~/.claude/settings.json`; hooks do not read project-level settings):
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"patterns": [
|
|
113
|
+
"acme_[A-Za-z0-9]{32}",
|
|
114
|
+
{"label": "Acme service token", "regex": "(?P<keep>ACME_TOKEN=)\\S+", "ignore_case": true}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- Each entry is a Python regular expression, either as a plain string or as an object with `regex`, an optional `label` (shown in the placeholder, default `custom pattern`), and an optional `ignore_case`. JSON strings need doubled backslashes (`\\d` for `\d`).
|
|
120
|
+
- Text matched by a named group `keep` stays in place and only the rest of the match is replaced, the same way the built-in `?token=` pattern keeps the parameter name.
|
|
121
|
+
- `TOKEN_OPTIMIZER_REDACT_PATTERNS_FILE` must be an absolute path after `~` and environment-variable expansion (surrounding quotes are stripped first). A relative value would resolve against whatever directory the hook launched in, so it is treated as a configuration error — see fail-closed behavior below.
|
|
122
|
+
- Custom patterns are additive and run BEFORE the built-ins, so an org pattern can claim a composite secret (e.g. `MEDX-123456-<jwt>`) whole instead of leaving a readable prefix beside a built-in placeholder. Neither custom nor built-in patterns touch `[CREDENTIAL REDACTED: ...]` placeholders already in the text, so re-running redaction is idempotent. Custom patterns apply everywhere the built-in redaction applies; when scanning rather than rewriting, they are matched per line. They do not change which lines Bash compression keeps verbatim.
|
|
123
|
+
- The file is read once per process. Invalid entries (bad regex, empty regex, a regex that matches empty text, wrong types, unsafe or over-broad shapes) are skipped with a warning on stderr; the rest still load. A missing file at the default location is ignored. Limits: 200 entries, 1,000 characters per regex, 1 MB per file.
|
|
124
|
+
- **Fail closed:** if the configured file — or a file present at the default location — cannot be trusted (unreadable, invalid JSON, wrong shape, or a relative env path), custom redaction is considered broken rather than absent. Every write that redacts (archives, caches, checkpoints) is then skipped so content your own patterns were meant to cover never reaches disk unredacted, and a one-time warning is shown through the hook's normal output channel. Fix or remove the file to resume writes. Checkpoints are written by the PreCompact, Stop and SessionEnd hooks, so with a broken file they stop too; the first skipped checkpoint of each session says so in one `systemMessage` line naming the file, and later hooks in that session stay quiet. `measure.py doctor` shows the same status ("CUSTOM REDACTION INACTIVE").
|
|
125
|
+
- Unsafe patterns are rejected before they can run: the loader statically rejects nested unbounded quantifiers and ambiguous repeated alternations (the classic "regex hangs forever" shapes), then runs each remaining pattern once against a battery of adversarial strings in a separate process with a hard time limit — a pattern that cannot finish in time is rejected. Verdicts are cached per file content, so this costs nothing on steady-state hook runs.
|
|
126
|
+
- `measure.py security-report` shows whether custom redaction is active, how many patterns loaded, from which file, and any rejections; the same status is persisted under the runtime's `token-optimizer/` directory.
|
|
127
|
+
- This is pattern-based redaction of known shapes. It is not a general PII or PHI scrubber, and it cannot catch values that have no recognizable shape.
|
|
128
|
+
|
|
129
|
+
## Consent
|
|
130
|
+
|
|
131
|
+
On first activation, Token Optimizer shows a data notice describing what is stored locally and requires acknowledgment before data collection begins. Hooks exit early (no data collection, no blocking tool calls) until consent is granted.
|
|
132
|
+
|
|
133
|
+
- Check consent status: `python3 measure.py consent --show`
|
|
134
|
+
- Reset consent: `python3 measure.py consent --reset`
|
|
135
|
+
- Grant consent: `python3 measure.py consent --grant`
|
|
136
|
+
|
|
137
|
+
Existing users who already saw the v5 welcome notice are automatically considered consented (backward compatible).
|
|
138
|
+
|
|
139
|
+
## Transcript Preservation
|
|
140
|
+
|
|
141
|
+
Token Optimizer sets `cleanupPeriodDays=99999` in the host platform's `settings.json` to preserve session transcripts for trend analysis. This is the host platform's cleanup setting, not Token Optimizer's data.
|
|
142
|
+
|
|
143
|
+
- Transcripts are the host platform's data (JSONL files), not Token Optimizer's
|
|
144
|
+
- Users can override this setting in their `settings.json`
|
|
145
|
+
- The `purge` command does NOT delete transcripts (they belong to the host platform)
|
|
146
|
+
|
|
147
|
+
## Subagent Prompt-Cache Setting
|
|
148
|
+
|
|
149
|
+
On Claude Code 2.1.243+, Token Optimizer measures whether `subagentPromptCacheTtl: "1h"` would pay on your own transcripts and recommends it -- it never sets the key for you. `subagent-cache enable` applies the recommendation (setting it once in the user `settings.json` so subagents keep their prompt cache for an hour instead of five minutes). This is the host platform's billing setting, not Token Optimizer data.
|
|
150
|
+
|
|
151
|
+
- Never overrides a value you set yourself, an env override, or a managed/project/local settings file
|
|
152
|
+
- Undone by `python3 measure.py subagent-cache disable` (final) or by `TOKEN_OPTIMIZER_SUBAGENT_CACHE_1H=0`
|
|
153
|
+
- `TOKEN_OPTIMIZER_SUBAGENT_CACHE_1H=1` is the only automatic write -- an explicit opt-in that also keeps a 14-day tripwire which reverts the change if it costs more than it saves
|
|
154
|
+
- The payoff check reads your own session transcripts locally, in a background process, and keeps one small verdict file and a marker in Token Optimizer's data directory; nothing leaves the machine
|
|
155
|
+
|
|
156
|
+
## Usage Recommendations
|
|
157
|
+
|
|
158
|
+
On Claude Code, a daily background measurement reads your own session transcripts and writes two local files in Token Optimizer's data directory: `usage_recommendations.json` (the current record -- one item each for the compact window and the subagent cache lifetime) and `usage_recommendations_history.jsonl` (one compact line per measurement, capped at 180 lines, used to show measured "wins" after you change a setting yourself). They feed the `recommendations` command and the dashboard's "From your own usage" section. Nothing leaves the machine, and Token Optimizer never writes `autoCompactWindow` or `subagentPromptCacheTtl` for you.
|
|
159
|
+
|
|
160
|
+
## Data Deletion
|
|
161
|
+
|
|
162
|
+
To delete all Token Optimizer data across all platforms:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
python3 measure.py purge # dry-run: shows what would be deleted
|
|
166
|
+
python3 measure.py purge --confirm # actually delete
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Manual deletion: remove the following directories:
|
|
170
|
+
- `~/.claude/token-optimizer/`
|
|
171
|
+
- `~/.claude/plugins/data/token-optimizer-*/`
|
|
172
|
+
- `~/.claude/_backups/token-optimizer/`
|
|
173
|
+
- For Codex: `~/.codex/token-optimizer/`
|
|
174
|
+
- For OpenCode: `~/.local/share/opencode/token-optimizer/`
|
|
175
|
+
- For Cursor: `~/.cursor/token-optimizer/`
|
|
176
|
+
- For Antigravity: `~/.gemini/token-optimizer/` (and, to also remove the hook wiring, `~/.gemini/config/plugins/token-optimizer/`)
|
|
177
|
+
|
|
178
|
+
## Claude Code Cloud Sessions
|
|
179
|
+
|
|
180
|
+
The cloud setup script (`measure.py cloud-setup-script`) runs inside your cloud environment's VM, not on your machine. It makes one download, the `@alexgreensh/token-optimizer` package from registry.npmjs.org, and checks its sha512 before running anything in it. No product data is sent, then or later.
|
|
181
|
+
|
|
182
|
+
- **Where data lives**: Token Optimizer itself goes to `~/.cache/token-optimizer-cloud/` in the VM, and its hooks are merged into the VM's `~/.claude/settings.json`. Session data (trends, archives, checkpoints) goes to the usual `~/.claude` paths in the VM.
|
|
183
|
+
- **Nothing in your repository**: nothing is written to the working tree, including Python bytecode (redirected to the cache directory).
|
|
184
|
+
- **Nothing persists**: all of it is deleted with the VM. Nothing is carried to the next session or to your machine.
|
|
185
|
+
|
|
186
|
+
## Cross-Platform
|
|
187
|
+
|
|
188
|
+
Locally installed extensions (see `docs/local-extensions.md`) may run inside the session-end flush worker; Token Optimizer ships none by default.
|
|
189
|
+
|
|
190
|
+
The same privacy guarantees apply across all supported platforms (Claude Code, Codex, OpenCode, Hermes, Copilot, Cursor, Google Antigravity). Data paths vary by platform but the architecture is identical: local-only, zero network, credential-redacted storage.
|
|
191
|
+
|
|
192
|
+
Consent is tracked per-runtime. A user running both Claude Code and Codex must acknowledge consent separately in each runtime. Antigravity collection is additionally gated by the bridge itself (R20): the Antigravity hooks and rollup no-op until `~/.gemini/token-optimizer/config.json` records `antigravity_consent: true`.
|
|
193
|
+
|
|
194
|
+
## Source Available
|
|
195
|
+
|
|
196
|
+
Token Optimizer is licensed under [PolyForm Noncommercial 1.0.0](LICENSE). The full source code is published at [github.com/alexgreensh/token-optimizer](https://github.com/alexgreensh/token-optimizer) and can be audited by anyone. Non-commercial use (personal, research, education) requires no license purchase. Commercial use requires a separate license.
|
|
197
|
+
|
|
198
|
+
## Contact
|
|
199
|
+
|
|
200
|
+
For privacy-related questions, reach out to [Alex Greenshpun](https://linkedin.com/in/alexgreensh) or open an issue on the [GitHub repository](https://github.com/alexgreensh/token-optimizer/issues).
|
package/README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Token Optimizer for Claude Code cloud sessions
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package is [Token Optimizer](https://github.com/alexgreensh/token-optimizer), the Claude Code plugin, packed for Claude Code cloud sessions (claude.ai/code). Cloud sessions don't load plugins, so this package carries the same hooks and scripts as the plugin, version for version.
|
|
4
|
+
|
|
5
|
+
You don't `npm install` it. Install it from your cloud environment's setup script:
|
|
6
|
+
|
|
7
|
+
1. On a machine with Token Optimizer installed, run `python3 measure.py cloud-setup-script` (or ask Claude: "print the Token Optimizer cloud setup script").
|
|
8
|
+
2. Paste the output into claude.ai/code > your environment > Setup script.
|
|
9
|
+
|
|
10
|
+
Each new session in that environment then runs the real Token Optimizer hooks, in any repo. The setup script downloads this tarball from registry.npmjs.org and checks its sha512 before running anything in it. It never fails your setup and prints nothing (log: `~/.cache/token-optimizer-cloud/install.log` in the VM).
|
|
11
|
+
|
|
12
|
+
Docs: https://alexgreensh.github.io/token-optimizer/install/claude-code-cloud/
|
|
13
|
+
|
|
14
|
+
License: PolyForm Noncommercial 1.0.0, plus the small-business grant in `LICENSE-SMALL-BUSINESS.md`.
|