pickaxetax 0.1.0__tar.gz

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.
Files changed (53) hide show
  1. pickaxetax-0.1.0/LICENSE +202 -0
  2. pickaxetax-0.1.0/PKG-INFO +179 -0
  3. pickaxetax-0.1.0/README.md +151 -0
  4. pickaxetax-0.1.0/pickaxetax/__init__.py +7 -0
  5. pickaxetax-0.1.0/pickaxetax/analyze/__init__.py +90 -0
  6. pickaxetax-0.1.0/pickaxetax/analyze/depth.py +104 -0
  7. pickaxetax-0.1.0/pickaxetax/analyze/intent.py +91 -0
  8. pickaxetax-0.1.0/pickaxetax/analyze/suggest.py +106 -0
  9. pickaxetax-0.1.0/pickaxetax/analyze/waste.py +141 -0
  10. pickaxetax-0.1.0/pickaxetax/bench/__init__.py +4 -0
  11. pickaxetax-0.1.0/pickaxetax/bench/runner.py +173 -0
  12. pickaxetax-0.1.0/pickaxetax/bench/tasks.py +56 -0
  13. pickaxetax-0.1.0/pickaxetax/cbi.py +76 -0
  14. pickaxetax-0.1.0/pickaxetax/cli.py +221 -0
  15. pickaxetax-0.1.0/pickaxetax/graph/__init__.py +4 -0
  16. pickaxetax-0.1.0/pickaxetax/graph/export.py +79 -0
  17. pickaxetax-0.1.0/pickaxetax/graph/store.py +286 -0
  18. pickaxetax-0.1.0/pickaxetax/ingest/__init__.py +35 -0
  19. pickaxetax-0.1.0/pickaxetax/ingest/exports.py +117 -0
  20. pickaxetax-0.1.0/pickaxetax/ingest/share.py +149 -0
  21. pickaxetax-0.1.0/pickaxetax/ingest/transcript.py +50 -0
  22. pickaxetax-0.1.0/pickaxetax/models.py +84 -0
  23. pickaxetax-0.1.0/pickaxetax/proxy/__init__.py +5 -0
  24. pickaxetax-0.1.0/pickaxetax/proxy/app.py +193 -0
  25. pickaxetax-0.1.0/pickaxetax/proxy/cache.py +50 -0
  26. pickaxetax-0.1.0/pickaxetax/proxy/formats.py +127 -0
  27. pickaxetax-0.1.0/pickaxetax/proxy/ledger.py +97 -0
  28. pickaxetax-0.1.0/pickaxetax/proxy/messages.py +137 -0
  29. pickaxetax-0.1.0/pickaxetax/service.py +53 -0
  30. pickaxetax-0.1.0/pickaxetax/text.py +201 -0
  31. pickaxetax-0.1.0/pickaxetax/tokens.py +31 -0
  32. pickaxetax-0.1.0/pickaxetax/web/__init__.py +3 -0
  33. pickaxetax-0.1.0/pickaxetax/web/app.py +101 -0
  34. pickaxetax-0.1.0/pickaxetax/web/static/app.js +344 -0
  35. pickaxetax-0.1.0/pickaxetax/web/static/index.html +66 -0
  36. pickaxetax-0.1.0/pickaxetax/web/static/style.css +120 -0
  37. pickaxetax-0.1.0/pickaxetax.egg-info/PKG-INFO +179 -0
  38. pickaxetax-0.1.0/pickaxetax.egg-info/SOURCES.txt +51 -0
  39. pickaxetax-0.1.0/pickaxetax.egg-info/dependency_links.txt +1 -0
  40. pickaxetax-0.1.0/pickaxetax.egg-info/entry_points.txt +3 -0
  41. pickaxetax-0.1.0/pickaxetax.egg-info/requires.txt +10 -0
  42. pickaxetax-0.1.0/pickaxetax.egg-info/top_level.txt +1 -0
  43. pickaxetax-0.1.0/pyproject.toml +49 -0
  44. pickaxetax-0.1.0/setup.cfg +4 -0
  45. pickaxetax-0.1.0/tests/test_analyze.py +112 -0
  46. pickaxetax-0.1.0/tests/test_api.py +60 -0
  47. pickaxetax-0.1.0/tests/test_bench.py +80 -0
  48. pickaxetax-0.1.0/tests/test_cbi.py +47 -0
  49. pickaxetax-0.1.0/tests/test_ingest.py +153 -0
  50. pickaxetax-0.1.0/tests/test_parity.py +133 -0
  51. pickaxetax-0.1.0/tests/test_proxy.py +209 -0
  52. pickaxetax-0.1.0/tests/test_store.py +95 -0
  53. pickaxetax-0.1.0/tests/test_tokens.py +14 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,179 @@
1
+ Metadata-Version: 2.4
2
+ Name: pickaxetax
3
+ Version: 0.1.0
4
+ Summary: Pickaxe Tax: measure and cut wasted AI compute -- local LLM proxy, conversation skeletons, over-computation benchmark, Compute Bubble Index.
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/graviton94/pickaxetax
7
+ Project-URL: Web app, https://graviton94.github.io/pickaxetax/
8
+ Project-URL: Source, https://github.com/graviton94/pickaxetax
9
+ Project-URL: Issues, https://github.com/graviton94/pickaxetax/issues
10
+ Keywords: llm,tokens,efficiency,proxy,openai,anthropic,benchmark,sustainability
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
15
+ Classifier: Topic :: Internet :: Proxy Servers
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: fastapi>=0.110
20
+ Requires-Dist: uvicorn>=0.27
21
+ Requires-Dist: httpx>=0.27
22
+ Requires-Dist: python-multipart>=0.0.9
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=8; extra == "dev"
25
+ Provides-Extra: tiktoken
26
+ Requires-Dist: tiktoken>=0.7; extra == "tiktoken"
27
+ Dynamic: license-file
28
+
29
+ # Pickaxe Tax
30
+
31
+ > **Stop paying the pickaxe tax.** `#AntiTokenMaxing`
32
+ > In a gold rush, the people selling pickaxes get rich. Your AI re-reads the whole conversation every single turn, and you pay for every re-read.
33
+ > Build less. Waste less. Use the compute we already have.
34
+
35
+
36
+ **Try it in your browser (nothing is uploaded): https://graviton94.github.io/pickaxetax/** · `pip install pickaxetax`
37
+
38
+ [한국어](#한국어) · [Charter (KO)](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/CHARTER.md) · [Decisions](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/decisions/README.md) · [Architecture](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/ARCHITECTURE.md) · [Privacy](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/PRIVACY.md)
39
+
40
+ **Chat models re-read the entire conversation on every turn.** Late constraints, re-asks, "thanks!" messages and topic switches inside one chat make that cost grow quadratically. Pickaxe Tax takes a shared conversation (share link, export JSON or pasted transcript) and **throws the text away**. What it keeps is a graph skeleton: agenda (topic labels), structure (per-turn intents and typed edges such as DEEPENS, PIVOTS, CORRECTS and RETRIES), depth (topic threads and drill-down level) and token flow. It then shows:
41
+
42
+ - actual vs. optimal compute (one focused chat per topic, with the waste removed) and a one-shot lower bound
43
+ - where the compute leaked: thank-you messages, discarded answers, re-sent off-topic history
44
+ - a one-shot prompt skeleton built only from topic labels
45
+ - habits to change, ranked by measured waste
46
+
47
+ Contributed skeletons feed a public, **k-anonymous** topic graph (a topic is shown only once it appears in ≥ k conversations) plus aggregate waste statistics. The analyzer itself calls **no LLM**: a project about saving tokens shouldn't spend them.
48
+
49
+ ```bash
50
+ pip install -e ".[dev]"
51
+ pickaxetax serve # conversation skeleton analyzer (web); `pxt` is a short alias
52
+ pickaxetax proxy # local proxy: OpenAI-compatible /v1, Anthropic base URL
53
+ pickaxetax ledger # tokens spent, context re-sent, tokens avoided
54
+ pickaxetax bench run --base-url http://localhost:11434 --model llama3.2 # donate benchmark compute
55
+ pytest
56
+ ```
57
+
58
+ **Local proxy.** Point your client at it and it forwards to the real provider with your own key, which it never stores. It measures every request (input, output, reasoning, re-sent context). By default it also drops earlier pure thank-you exchanges from the history and answers a bare "thanks" locally instead of re-reading the whole chat. "ok"/"yes" are never short-circuited, because in agent workflows they mean "go ahead". Requests with tools are never rewritten. Opt-in: `--cache` reuses responses to identical temperature-0 requests, stored on your disk.
59
+
60
+ **Web app (local-first).** `site/` is a static page that runs the same engine in your browser. You can paste text, drop an export file, or use a share link through a bookmarklet that reads the page you already have open. Its Content-Security-Policy (`connect-src 'none'`) makes it impossible for the page to send your conversation anywhere. It is deployed to GitHub Pages; to run it locally: `cd site && python3 -m http.server`.
61
+
62
+ **How to help at zero cost:** see [CONTRIBUTING.md](https://github.com/graviton94/pickaxetax/blob/HEAD/CONTRIBUTING.md).
63
+
64
+ See [docs/ARCHITECTURE.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/ARCHITECTURE.md) and [docs/PRIVACY.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/PRIVACY.md).
65
+
66
+ ### Where this is going
67
+
68
+ The AI boom is turning into a gold rush where only the pick-and-shovel sellers win: more GPUs, more data centers, more power. The waste is not only in conversations. It runs through the whole compute stack: infrastructure built ahead of revenue, oversized models and needless reasoning tokens, and wasteful usage. Pickaxe Tax is the open toolkit of **#AntiTokenMaxing**, a global effort to **prove that with public data and remove it with open tools**:
69
+
70
+ - **Shared brain**: solution-path graph + open efficiency dataset, built from conversation *skeletons* contributed by users worldwide
71
+ - **Prompt compiler**: a local proxy/SDK and coding-agent plugin that compile wasteful requests into minimal ones and measure the savings
72
+ - **Watchdog — Compute Bubble Index**: how much of the deployed AI compute actually produced value? Top-down capital data (capex vs. AI revenue, circular deals, depreciation assumptions) meets bottom-up measurements (model over-computation, avoidable usage), published as a dashboard and a quarterly "gold rush bill" report ([design, KO](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/BUBBLE_INDEX.md))
73
+ - **Standard**: a Token Efficiency Index for models and products
74
+
75
+ Principles: local-first (raw text never leaves your device), two-step consent, no LLM calls in the analysis path, cold data and bold messages, and a mirror rather than an enemy to model developers. Public goods (data, standard, core engine) are held by a foundation under irrevocable open licenses. Full charter: [docs/CHARTER.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/CHARTER.md).
76
+
77
+ ## License
78
+
79
+ Code: [Apache-2.0](https://github.com/graviton94/pickaxetax/blob/HEAD/LICENSE) · Data: [ODbL 1.0](https://github.com/graviton94/pickaxetax/blob/HEAD/DATA_LICENSE.md)
80
+
81
+ ---
82
+
83
+ ## 한국어
84
+
85
+ **Pickaxe Tax (곡괭이세)**: 골드러시에서 돈을 버는 건 곡괭이 판매자다. 우리는 그 세금을 그만 낸다. 운동명은 **#AntiTokenMaxing**이다.
86
+
87
+ > **AI는 같은 대화를 매 턴 처음부터 다시 읽습니다.**
88
+ > 원문은 버리고, 대화의 *모양*만 남겨, 불필요했던 연산을 드러냅니다.
89
+
90
+ 프로젝트의 핵심 가치, 방향성, 조직 구조는 [프로젝트 헌장](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/CHARTER.md)에 정리되어 있습니다.
91
+
92
+ ### 왜 만드나
93
+
94
+ "토큰맥싱"(token-maxing)은 습관입니다. 조건을 나중에 덧붙이고, 같은 질문을 다시 하고, 답이 끝난 뒤 "고마워"를 보내고, 한 창에서 주제를 바꿔 계속 이어 갑니다. 채팅형 AI는 답할 때마다 **이전 대화 전체를 다시 입력으로 읽기** 때문에 이런 습관의 비용은 대화 길이에 따라 제곱으로 커집니다. 40번째 턴의 "고마워" 한 마디는 수만 토큰을 다시 처리하게 만듭니다.
95
+
96
+ 이렇게 불어난 연산은 GPU, 데이터센터, 전력 수요로 이어집니다. 이 프로젝트는 그 낭비를 **측정 가능한 숫자**로 보여 주고, 다음 대화에서 바로 쓸 수 있는 습관과 프롬프트 골격으로 되돌려 주는 공익 프로젝트입니다. 배경과 원칙은 [docs/MANIFESTO.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/MANIFESTO.md)에 있습니다.
97
+
98
+ ### 무엇을 하나
99
+
100
+ 1. **올리기**: ChatGPT·Claude·Gemini 등의 공유 링크, 데이터 내보내기 JSON, 또는 `User:` / `Assistant:` 형식의 텍스트
101
+ 2. **골격 추출**: 원문을 메모리에서만 분석해 다음 항목을 뽑습니다
102
+ - **아젠다**: 대화의 핵심 주제 라벨
103
+ - **스트럭처**: 턴마다의 의도(질문·지시·보충·정정·재질문·계속·감사·대용량 붙여넣기)와 턴 사이의 관계(DEEPENS, PIVOTS, RETURNS, CORRECTS, RETRIES …)
104
+ - **뎁스**: 주제 갈래(branch)와 각 갈래 안의 파고들기 깊이
105
+ - **토큰 흐름**: 보이는 토큰, 실제 과금 입력(이력 재전송), 출력
106
+ 3. **원문 폐기**: 텍스트는 저장하지 않습니다. 저장되는 것은 골격(숫자, 의도 라벨, 주제 라벨, 솔트된 지문)뿐입니다
107
+ 4. **그래프 DB화**: `(:Conversation)-[:HAS_TURN]->(:Turn)-[:ABOUT]->(:Topic)` 형태의 속성 그래프로 저장합니다. Neo4j로 보낼 수 있는 Cypher 내보내기도 제공합니다
108
+ 5. **되돌려 주기**
109
+ - 실제 연산과 최적 연산 비교 (주제별 새 대화 + 낭비 제거 기준, 한 번에 물었을 때의 하한선)
110
+ - 낭비 유형별 비중: 감사 메시지, 버려진 답변, 무관한 주제 재전송
111
+ - 주제 라벨만으로 만든 **한 번에 끝내는 프롬프트 골격**
112
+ - 측정된 낭비 순으로 정렬한 습관 교정 팁
113
+ 6. **공익 그래프**: 기여된 골격을 집계해 주제 동시출현 그래프와 전체 낭비 통계를 공개합니다. **k-익명성**을 적용해 k개(기본 3개) 이상의 대화에서 등장한 주제만 노출합니다
114
+
115
+ 분석기 자체는 **LLM을 호출하지 않습니다.** 규칙 기반 의도 분류, 키워드 랭킹, SimHash를 쓰므로 분석에 드는 연산은 거의 0입니다.
116
+
117
+ ### 빠른 시작
118
+
119
+ ```bash
120
+ pip install -e ".[dev]"
121
+ pickaxetax serve # http://127.0.0.1:8000
122
+ # 또는
123
+ pickaxetax analyze chat.txt # 로컬 분석 (기본값은 저장 안 함)
124
+ pickaxetax analyze conversations.json --save
125
+ pickaxetax analyze https://chatgpt.com/share/... --json
126
+ pickaxetax export > public_graph.cypher
127
+ pytest
128
+ ```
129
+
130
+ | 환경 변수 | 기본값 | 설명 |
131
+ |---|---|---|
132
+ | `PICKAXETAX_DB` | `data/pickaxetax.sqlite3` | 그래프 저장소 경로 |
133
+ | `PICKAXETAX_SECRET` | 자동 생성 후 DB에 보관 | ID와 지문에 쓰는 솔트. 운영 환경에서는 직접 지정 권장 |
134
+ | `PICKAXETAX_K_ANON` | `3` | 공개 그래프의 k-익명성 임계값 (API로는 낮출 수 없음) |
135
+ | `PICKAXETAX_INPUT_WEIGHT` | `0.25` | 입력 토큰 연산 가중치 (출력 = 1) |
136
+ | `PICKAXETAX_WH_PER_1K` | `0.5` | 1k 연산 단위당 Wh. **예시용 가정치** |
137
+
138
+ ### API
139
+
140
+ | 메서드 | 경로 | 설명 |
141
+ |---|---|---|
142
+ | POST | `/api/analyze` | `{"input": "<링크|JSON|텍스트>", "save": true}` |
143
+ | POST | `/api/analyze/file` | multipart 파일 업로드 (`file`, `save`) |
144
+ | GET | `/api/conversations/{id}` | 골격 조회 |
145
+ | GET | `/api/conversations/{id}/graph.json` · `/cypher` | 내보내기 |
146
+ | DELETE | `/api/conversations/{id}` | `X-Delete-Token` 헤더로 내 기여 삭제 |
147
+ | GET | `/api/stats` | 전체 임팩트 집계 |
148
+ | GET | `/api/topics` · `/api/topics/cypher` | k-익명 주제 그래프 |
149
+
150
+ 대화형 문서는 `/api/docs`에 있습니다.
151
+
152
+ ### 구조
153
+
154
+ ```
155
+ pickaxetax/
156
+ ingest/ 공유 링크(SSRF 방지 허용 목록), 내보내기 JSON, 텍스트 파서
157
+ analyze/ 의도 분류 · 깊이/갈래 · 토큰 회계 · 제안 생성 (LLM 미사용)
158
+ graph/ SQLite 속성 그래프 저장소 + Cypher/JSON 내보내기
159
+ web/ FastAPI + 의존성 없는 단일 페이지 UI (한/영)
160
+ cli.py
161
+ docs/ MANIFESTO · ARCHITECTURE · PRIVACY
162
+ ```
163
+
164
+ 자세한 설계는 [docs/ARCHITECTURE.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/ARCHITECTURE.md), 개인정보 설계는 [docs/PRIVACY.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/PRIVACY.md)를 보세요.
165
+
166
+ ### 로드맵
167
+
168
+ - [ ] 브라우저 확장 또는 WASM으로 **클라이언트 측 골격 추출** (원문이 서버로 아예 가지 않게)
169
+ - [ ] 공유 페이지 파서 강화 (클라이언트 렌더링되는 ChatGPT와 Gemini 신규 포맷)
170
+ - [ ] 집계 통계에 차등 프라이버시 노이즈 추가
171
+ - [ ] 주제별 "최단 경로" 패턴 라이브러리: 같은 아젠다를 가장 적은 턴으로 끝낸 구조 공유
172
+ - [ ] 다국어 형태소 처리 (일본어, 중국어 분절)
173
+ - [ ] Neo4j·Memgraph 백엔드 어댑터, 공개 데이터셋 정기 배포
174
+ - [ ] 측정 기반 에너지 계수 (공개 벤치마크 연동)
175
+ - [ ] 요청 속도 제한과 악용 방지
176
+
177
+ ### 라이선스
178
+
179
+ 코드는 [Apache-2.0](https://github.com/graviton94/pickaxetax/blob/HEAD/LICENSE), 데이터는 [ODbL 1.0](https://github.com/graviton94/pickaxetax/blob/HEAD/DATA_LICENSE.md)을 따릅니다.
@@ -0,0 +1,151 @@
1
+ # Pickaxe Tax
2
+
3
+ > **Stop paying the pickaxe tax.** `#AntiTokenMaxing`
4
+ > In a gold rush, the people selling pickaxes get rich. Your AI re-reads the whole conversation every single turn, and you pay for every re-read.
5
+ > Build less. Waste less. Use the compute we already have.
6
+
7
+
8
+ **Try it in your browser (nothing is uploaded): https://graviton94.github.io/pickaxetax/** · `pip install pickaxetax`
9
+
10
+ [한국어](#한국어) · [Charter (KO)](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/CHARTER.md) · [Decisions](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/decisions/README.md) · [Architecture](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/ARCHITECTURE.md) · [Privacy](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/PRIVACY.md)
11
+
12
+ **Chat models re-read the entire conversation on every turn.** Late constraints, re-asks, "thanks!" messages and topic switches inside one chat make that cost grow quadratically. Pickaxe Tax takes a shared conversation (share link, export JSON or pasted transcript) and **throws the text away**. What it keeps is a graph skeleton: agenda (topic labels), structure (per-turn intents and typed edges such as DEEPENS, PIVOTS, CORRECTS and RETRIES), depth (topic threads and drill-down level) and token flow. It then shows:
13
+
14
+ - actual vs. optimal compute (one focused chat per topic, with the waste removed) and a one-shot lower bound
15
+ - where the compute leaked: thank-you messages, discarded answers, re-sent off-topic history
16
+ - a one-shot prompt skeleton built only from topic labels
17
+ - habits to change, ranked by measured waste
18
+
19
+ Contributed skeletons feed a public, **k-anonymous** topic graph (a topic is shown only once it appears in ≥ k conversations) plus aggregate waste statistics. The analyzer itself calls **no LLM**: a project about saving tokens shouldn't spend them.
20
+
21
+ ```bash
22
+ pip install -e ".[dev]"
23
+ pickaxetax serve # conversation skeleton analyzer (web); `pxt` is a short alias
24
+ pickaxetax proxy # local proxy: OpenAI-compatible /v1, Anthropic base URL
25
+ pickaxetax ledger # tokens spent, context re-sent, tokens avoided
26
+ pickaxetax bench run --base-url http://localhost:11434 --model llama3.2 # donate benchmark compute
27
+ pytest
28
+ ```
29
+
30
+ **Local proxy.** Point your client at it and it forwards to the real provider with your own key, which it never stores. It measures every request (input, output, reasoning, re-sent context). By default it also drops earlier pure thank-you exchanges from the history and answers a bare "thanks" locally instead of re-reading the whole chat. "ok"/"yes" are never short-circuited, because in agent workflows they mean "go ahead". Requests with tools are never rewritten. Opt-in: `--cache` reuses responses to identical temperature-0 requests, stored on your disk.
31
+
32
+ **Web app (local-first).** `site/` is a static page that runs the same engine in your browser. You can paste text, drop an export file, or use a share link through a bookmarklet that reads the page you already have open. Its Content-Security-Policy (`connect-src 'none'`) makes it impossible for the page to send your conversation anywhere. It is deployed to GitHub Pages; to run it locally: `cd site && python3 -m http.server`.
33
+
34
+ **How to help at zero cost:** see [CONTRIBUTING.md](https://github.com/graviton94/pickaxetax/blob/HEAD/CONTRIBUTING.md).
35
+
36
+ See [docs/ARCHITECTURE.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/ARCHITECTURE.md) and [docs/PRIVACY.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/PRIVACY.md).
37
+
38
+ ### Where this is going
39
+
40
+ The AI boom is turning into a gold rush where only the pick-and-shovel sellers win: more GPUs, more data centers, more power. The waste is not only in conversations. It runs through the whole compute stack: infrastructure built ahead of revenue, oversized models and needless reasoning tokens, and wasteful usage. Pickaxe Tax is the open toolkit of **#AntiTokenMaxing**, a global effort to **prove that with public data and remove it with open tools**:
41
+
42
+ - **Shared brain**: solution-path graph + open efficiency dataset, built from conversation *skeletons* contributed by users worldwide
43
+ - **Prompt compiler**: a local proxy/SDK and coding-agent plugin that compile wasteful requests into minimal ones and measure the savings
44
+ - **Watchdog — Compute Bubble Index**: how much of the deployed AI compute actually produced value? Top-down capital data (capex vs. AI revenue, circular deals, depreciation assumptions) meets bottom-up measurements (model over-computation, avoidable usage), published as a dashboard and a quarterly "gold rush bill" report ([design, KO](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/BUBBLE_INDEX.md))
45
+ - **Standard**: a Token Efficiency Index for models and products
46
+
47
+ Principles: local-first (raw text never leaves your device), two-step consent, no LLM calls in the analysis path, cold data and bold messages, and a mirror rather than an enemy to model developers. Public goods (data, standard, core engine) are held by a foundation under irrevocable open licenses. Full charter: [docs/CHARTER.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/CHARTER.md).
48
+
49
+ ## License
50
+
51
+ Code: [Apache-2.0](https://github.com/graviton94/pickaxetax/blob/HEAD/LICENSE) · Data: [ODbL 1.0](https://github.com/graviton94/pickaxetax/blob/HEAD/DATA_LICENSE.md)
52
+
53
+ ---
54
+
55
+ ## 한국어
56
+
57
+ **Pickaxe Tax (곡괭이세)**: 골드러시에서 돈을 버는 건 곡괭이 판매자다. 우리는 그 세금을 그만 낸다. 운동명은 **#AntiTokenMaxing**이다.
58
+
59
+ > **AI는 같은 대화를 매 턴 처음부터 다시 읽습니다.**
60
+ > 원문은 버리고, 대화의 *모양*만 남겨, 불필요했던 연산을 드러냅니다.
61
+
62
+ 프로젝트의 핵심 가치, 방향성, 조직 구조는 [프로젝트 헌장](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/CHARTER.md)에 정리되어 있습니다.
63
+
64
+ ### 왜 만드나
65
+
66
+ "토큰맥싱"(token-maxing)은 습관입니다. 조건을 나중에 덧붙이고, 같은 질문을 다시 하고, 답이 끝난 뒤 "고마워"를 보내고, 한 창에서 주제를 바꿔 계속 이어 갑니다. 채팅형 AI는 답할 때마다 **이전 대화 전체를 다시 입력으로 읽기** 때문에 이런 습관의 비용은 대화 길이에 따라 제곱으로 커집니다. 40번째 턴의 "고마워" 한 마디는 수만 토큰을 다시 처리하게 만듭니다.
67
+
68
+ 이렇게 불어난 연산은 GPU, 데이터센터, 전력 수요로 이어집니다. 이 프로젝트는 그 낭비를 **측정 가능한 숫자**로 보여 주고, 다음 대화에서 바로 쓸 수 있는 습관과 프롬프트 골격으로 되돌려 주는 공익 프로젝트입니다. 배경과 원칙은 [docs/MANIFESTO.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/MANIFESTO.md)에 있습니다.
69
+
70
+ ### 무엇을 하나
71
+
72
+ 1. **올리기**: ChatGPT·Claude·Gemini 등의 공유 링크, 데이터 내보내기 JSON, 또는 `User:` / `Assistant:` 형식의 텍스트
73
+ 2. **골격 추출**: 원문을 메모리에서만 분석해 다음 항목을 뽑습니다
74
+ - **아젠다**: 대화의 핵심 주제 라벨
75
+ - **스트럭처**: 턴마다의 의도(질문·지시·보충·정정·재질문·계속·감사·대용량 붙여넣기)와 턴 사이의 관계(DEEPENS, PIVOTS, RETURNS, CORRECTS, RETRIES …)
76
+ - **뎁스**: 주제 갈래(branch)와 각 갈래 안의 파고들기 깊이
77
+ - **토큰 흐름**: 보이는 토큰, 실제 과금 입력(이력 재전송), 출력
78
+ 3. **원문 폐기**: 텍스트는 저장하지 않습니다. 저장되는 것은 골격(숫자, 의도 라벨, 주제 라벨, 솔트된 지문)뿐입니다
79
+ 4. **그래프 DB화**: `(:Conversation)-[:HAS_TURN]->(:Turn)-[:ABOUT]->(:Topic)` 형태의 속성 그래프로 저장합니다. Neo4j로 보낼 수 있는 Cypher 내보내기도 제공합니다
80
+ 5. **되돌려 주기**
81
+ - 실제 연산과 최적 연산 비교 (주제별 새 대화 + 낭비 제거 기준, 한 번에 물었을 때의 하한선)
82
+ - 낭비 유형별 비중: 감사 메시지, 버려진 답변, 무관한 주제 재전송
83
+ - 주제 라벨만으로 만든 **한 번에 끝내는 프롬프트 골격**
84
+ - 측정된 낭비 순으로 정렬한 습관 교정 팁
85
+ 6. **공익 그래프**: 기여된 골격을 집계해 주제 동시출현 그래프와 전체 낭비 통계를 공개합니다. **k-익명성**을 적용해 k개(기본 3개) 이상의 대화에서 등장한 주제만 노출합니다
86
+
87
+ 분석기 자체는 **LLM을 호출하지 않습니다.** 규칙 기반 의도 분류, 키워드 랭킹, SimHash를 쓰므로 분석에 드는 연산은 거의 0입니다.
88
+
89
+ ### 빠른 시작
90
+
91
+ ```bash
92
+ pip install -e ".[dev]"
93
+ pickaxetax serve # http://127.0.0.1:8000
94
+ # 또는
95
+ pickaxetax analyze chat.txt # 로컬 분석 (기본값은 저장 안 함)
96
+ pickaxetax analyze conversations.json --save
97
+ pickaxetax analyze https://chatgpt.com/share/... --json
98
+ pickaxetax export > public_graph.cypher
99
+ pytest
100
+ ```
101
+
102
+ | 환경 변수 | 기본값 | 설명 |
103
+ |---|---|---|
104
+ | `PICKAXETAX_DB` | `data/pickaxetax.sqlite3` | 그래프 저장소 경로 |
105
+ | `PICKAXETAX_SECRET` | 자동 생성 후 DB에 보관 | ID와 지문에 쓰는 솔트. 운영 환경에서는 직접 지정 권장 |
106
+ | `PICKAXETAX_K_ANON` | `3` | 공개 그래프의 k-익명성 임계값 (API로는 낮출 수 없음) |
107
+ | `PICKAXETAX_INPUT_WEIGHT` | `0.25` | 입력 토큰 연산 가중치 (출력 = 1) |
108
+ | `PICKAXETAX_WH_PER_1K` | `0.5` | 1k 연산 단위당 Wh. **예시용 가정치** |
109
+
110
+ ### API
111
+
112
+ | 메서드 | 경로 | 설명 |
113
+ |---|---|---|
114
+ | POST | `/api/analyze` | `{"input": "<링크|JSON|텍스트>", "save": true}` |
115
+ | POST | `/api/analyze/file` | multipart 파일 업로드 (`file`, `save`) |
116
+ | GET | `/api/conversations/{id}` | 골격 조회 |
117
+ | GET | `/api/conversations/{id}/graph.json` · `/cypher` | 내보내기 |
118
+ | DELETE | `/api/conversations/{id}` | `X-Delete-Token` 헤더로 내 기여 삭제 |
119
+ | GET | `/api/stats` | 전체 임팩트 집계 |
120
+ | GET | `/api/topics` · `/api/topics/cypher` | k-익명 주제 그래프 |
121
+
122
+ 대화형 문서는 `/api/docs`에 있습니다.
123
+
124
+ ### 구조
125
+
126
+ ```
127
+ pickaxetax/
128
+ ingest/ 공유 링크(SSRF 방지 허용 목록), 내보내기 JSON, 텍스트 파서
129
+ analyze/ 의도 분류 · 깊이/갈래 · 토큰 회계 · 제안 생성 (LLM 미사용)
130
+ graph/ SQLite 속성 그래프 저장소 + Cypher/JSON 내보내기
131
+ web/ FastAPI + 의존성 없는 단일 페이지 UI (한/영)
132
+ cli.py
133
+ docs/ MANIFESTO · ARCHITECTURE · PRIVACY
134
+ ```
135
+
136
+ 자세한 설계는 [docs/ARCHITECTURE.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/ARCHITECTURE.md), 개인정보 설계는 [docs/PRIVACY.md](https://github.com/graviton94/pickaxetax/blob/HEAD/docs/PRIVACY.md)를 보세요.
137
+
138
+ ### 로드맵
139
+
140
+ - [ ] 브라우저 확장 또는 WASM으로 **클라이언트 측 골격 추출** (원문이 서버로 아예 가지 않게)
141
+ - [ ] 공유 페이지 파서 강화 (클라이언트 렌더링되는 ChatGPT와 Gemini 신규 포맷)
142
+ - [ ] 집계 통계에 차등 프라이버시 노이즈 추가
143
+ - [ ] 주제별 "최단 경로" 패턴 라이브러리: 같은 아젠다를 가장 적은 턴으로 끝낸 구조 공유
144
+ - [ ] 다국어 형태소 처리 (일본어, 중국어 분절)
145
+ - [ ] Neo4j·Memgraph 백엔드 어댑터, 공개 데이터셋 정기 배포
146
+ - [ ] 측정 기반 에너지 계수 (공개 벤치마크 연동)
147
+ - [ ] 요청 속도 제한과 악용 방지
148
+
149
+ ### 라이선스
150
+
151
+ 코드는 [Apache-2.0](https://github.com/graviton94/pickaxetax/blob/HEAD/LICENSE), 데이터는 [ODbL 1.0](https://github.com/graviton94/pickaxetax/blob/HEAD/DATA_LICENSE.md)을 따릅니다.
@@ -0,0 +1,7 @@
1
+ """Pickaxe Tax: measure and cut wasted AI compute. #AntiTokenMaxing"""
2
+
3
+ from .analyze import analyze
4
+ from .ingest import ingest_text
5
+
6
+ __version__ = "0.1.0"
7
+ __all__ = ["analyze", "ingest_text", "__version__"]
@@ -0,0 +1,90 @@
1
+ """RawConversation -> Skeleton. The raw text does not leave this function."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import hashlib
6
+ import hmac
7
+ from collections import Counter
8
+ from datetime import datetime, timezone
9
+
10
+ from ..models import ASSISTANT, USER, RawConversation, Skeleton, TurnNode
11
+ from ..text import detect_language, jaccard, rank_keywords, simhash, simhash_similarity, split_code, words
12
+ from ..tokens import estimate_tokens
13
+ from . import intent as I
14
+ from .depth import build_structure
15
+ from .suggest import suggest
16
+ from .waste import account
17
+
18
+ AGENDA_SIZE = 7
19
+ USER_TOPICS = 5
20
+ ASSISTANT_TOPICS = 3
21
+
22
+
23
+ def analyze(raw: RawConversation, salt: bytes = b"") -> Skeleton:
24
+ turns_raw = [t for t in raw.turns if t.role in (USER, ASSISTANT) and t.text.strip()]
25
+ if not any(t.role == USER for t in turns_raw):
26
+ raise ValueError("conversation has no user turns")
27
+
28
+ language = detect_language(" ".join(t.text[:2000] for t in turns_raw))
29
+ ranked = rank_keywords(
30
+ [t.text for t in turns_raw if t.role == USER],
31
+ [t.text for t in turns_raw if t.role == ASSISTANT],
32
+ )
33
+ score = dict(ranked)
34
+ agenda = [w for w, _ in ranked[:AGENDA_SIZE]]
35
+
36
+ nodes: list[TurnNode] = []
37
+ user_prints: list[tuple[int, int, set]] = [] # (index, simhash, word set)
38
+ retry_of: dict[int, int] = {}
39
+ cues: dict[int, set[str]] = {} # transient, never stored
40
+
41
+ for idx, rt in enumerate(turns_raw):
42
+ tokens = estimate_tokens(rt.text)
43
+ _, has_code = split_code(rt.text)
44
+ ws = words(rt.text)
45
+ wset = set(ws)
46
+ limit = USER_TOPICS if rt.role == USER else ASSISTANT_TOPICS
47
+ topics = sorted((w for w in wset if w in score), key=lambda w: (-score[w], w))[:limit]
48
+ fp = simhash(rt.text, key=salt)
49
+ cues[idx] = wset if rt.role == USER else {w for w, _ in Counter(ws).most_common(8)}
50
+
51
+ if rt.role == USER:
52
+ first = not user_prints
53
+ similar = False
54
+ if len(wset) >= 3:
55
+ for j, jfp, jset in reversed(user_prints):
56
+ if simhash_similarity(fp, jfp) >= 0.9 or jaccard(wset, jset) >= 0.8:
57
+ retry_of[idx] = j
58
+ similar = True
59
+ break
60
+ user_prints.append((idx, fp, wset))
61
+ kind = I.classify_user(rt.text, tokens, similar, has_code, first=first)
62
+ else:
63
+ kind = I.classify_assistant(rt.text, tokens, has_code)
64
+
65
+ nodes.append(
66
+ TurnNode(index=idx, role=rt.role, tokens=tokens, intent=kind, topics=topics,
67
+ has_code=has_code, fingerprint=f"{fp:016x}")
68
+ )
69
+
70
+ edges = build_structure(nodes, retry_of, cues)
71
+ cues.clear()
72
+ metrics = account(nodes)
73
+
74
+ digest = hmac.new(salt, "|".join(f"{n.role}:{n.fingerprint}:{n.tokens}" for n in nodes).encode(),
75
+ hashlib.blake2b).hexdigest()[:20]
76
+ sk = Skeleton(
77
+ id=digest,
78
+ source=raw.source,
79
+ language=language,
80
+ agenda=agenda,
81
+ turns=nodes,
82
+ edges=edges,
83
+ metrics=metrics,
84
+ created_at=datetime.now(timezone.utc).replace(microsecond=0).isoformat(),
85
+ )
86
+ sk.suggestion = suggest(sk)
87
+ return sk
88
+
89
+
90
+ __all__ = ["analyze"]