claude-backup 0.1.9__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.
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Creative Commons Legal Code
|
|
2
|
+
|
|
3
|
+
CC0 1.0 Universal
|
|
4
|
+
|
|
5
|
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
6
|
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
7
|
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
8
|
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
9
|
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
10
|
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
11
|
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
12
|
+
HEREUNDER.
|
|
13
|
+
|
|
14
|
+
Statement of Purpose
|
|
15
|
+
|
|
16
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
17
|
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
18
|
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
19
|
+
authorship and/or a database (each, a "Work").
|
|
20
|
+
|
|
21
|
+
Certain owners wish to permanently relinquish those rights to a Work for
|
|
22
|
+
the purpose of contributing to a commons of creative, cultural and
|
|
23
|
+
scientific works ("Commons") that the public can reliably and without fear
|
|
24
|
+
of later claims of infringement build upon, modify, incorporate in other
|
|
25
|
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
26
|
+
and for any purposes, including without limitation commercial purposes.
|
|
27
|
+
These owners may contribute to the Commons to promote the ideal of a free
|
|
28
|
+
culture and the further production of creative, cultural and scientific
|
|
29
|
+
works, or to gain reputation or greater distribution for their Work in
|
|
30
|
+
part through the use and efforts of others.
|
|
31
|
+
|
|
32
|
+
For these and/or other purposes and motivations, and without any
|
|
33
|
+
expectation of additional consideration or compensation, the person
|
|
34
|
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
35
|
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
36
|
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
37
|
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
38
|
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
39
|
+
|
|
40
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
41
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
42
|
+
Related Rights"). Copyright and Related Rights include, but are not
|
|
43
|
+
limited to, the following:
|
|
44
|
+
|
|
45
|
+
i. the right to reproduce, adapt, distribute, perform, display,
|
|
46
|
+
communicate, and translate a Work;
|
|
47
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
48
|
+
iii. publicity and privacy rights pertaining to a person's image or
|
|
49
|
+
likeness depicted in a Work;
|
|
50
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
51
|
+
subject to the limitations in paragraph 4(a), below;
|
|
52
|
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
53
|
+
in a Work;
|
|
54
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
55
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
56
|
+
protection of databases, and under any national implementation
|
|
57
|
+
thereof, including any amended or successor version of such
|
|
58
|
+
directive); and
|
|
59
|
+
vii. other similar, equivalent or corresponding rights throughout the
|
|
60
|
+
world based on applicable law or treaty, and any national
|
|
61
|
+
implementations thereof.
|
|
62
|
+
|
|
63
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
64
|
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
65
|
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
66
|
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
67
|
+
of action, whether now known or unknown (including existing as well as
|
|
68
|
+
future claims and causes of action), in the Work (i) in all territories
|
|
69
|
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
70
|
+
treaty (including future time extensions), (iii) in any current or future
|
|
71
|
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
72
|
+
including without limitation commercial, advertising or promotional
|
|
73
|
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
74
|
+
member of the public at large and to the detriment of Affirmer's heirs and
|
|
75
|
+
successors, fully intending that such Waiver shall not be subject to
|
|
76
|
+
revocation, rescission, cancellation, termination, or any other legal or
|
|
77
|
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
78
|
+
as contemplated by Affirmer's express Statement of Purpose.
|
|
79
|
+
|
|
80
|
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
81
|
+
be judged legally invalid or ineffective under applicable law, then the
|
|
82
|
+
Waiver shall be preserved to the maximum extent permitted taking into
|
|
83
|
+
account Affirmer's express Statement of Purpose. In addition, to the
|
|
84
|
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
85
|
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
86
|
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
87
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
88
|
+
maximum duration provided by applicable law or treaty (including future
|
|
89
|
+
time extensions), (iii) in any current or future medium and for any number
|
|
90
|
+
of copies, and (iv) for any purpose whatsoever, including without
|
|
91
|
+
limitation commercial, advertising or promotional purposes (the
|
|
92
|
+
"License"). The License shall be deemed effective as of the date CC0 was
|
|
93
|
+
applied by Affirmer to the Work. Should any part of the License for any
|
|
94
|
+
reason be judged legally invalid or ineffective under applicable law, such
|
|
95
|
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
96
|
+
of the License, and in such case Affirmer hereby affirms that he or she
|
|
97
|
+
will not (i) exercise any of his or her remaining Copyright and Related
|
|
98
|
+
Rights in the Work or (ii) assert any associated claims and causes of
|
|
99
|
+
action with respect to the Work, in either case contrary to Affirmer's
|
|
100
|
+
express Statement of Purpose.
|
|
101
|
+
|
|
102
|
+
4. Limitations and Disclaimers.
|
|
103
|
+
|
|
104
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
105
|
+
surrendered, licensed or otherwise affected by this document.
|
|
106
|
+
b. Affirmer offers the Work as-is and makes no representations or
|
|
107
|
+
warranties of any kind concerning the Work, express, implied,
|
|
108
|
+
statutory or otherwise, including without limitation warranties of
|
|
109
|
+
title, merchantability, fitness for a particular purpose, non
|
|
110
|
+
infringement, or the absence of latent or other defects, accuracy, or
|
|
111
|
+
the present or absence of errors, whether or not discoverable, all to
|
|
112
|
+
the greatest extent permissible under applicable law.
|
|
113
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
114
|
+
that may apply to the Work or any use thereof, including without
|
|
115
|
+
limitation any person's Copyright and Related Rights in the Work.
|
|
116
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
117
|
+
consents, permissions or other rights required for any use of the
|
|
118
|
+
Work.
|
|
119
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
120
|
+
party to this document and has no duty or obligation with respect to
|
|
121
|
+
this CC0 or use of the Work.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claude-backup
|
|
3
|
+
Version: 0.1.9
|
|
4
|
+
Summary: Unofficial, unsanctioned tool to backup Claude.ai chats to local files.
|
|
5
|
+
Keywords: claude,backup,ai,chat,export,archive
|
|
6
|
+
Author-email: Ultrathinkers Anonymous <ultrathink@twilligon.com>
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-Expression: CC0-1.0
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
18
|
+
Classifier: Topic :: System :: Archiving :: Backup
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: aiohttp
|
|
22
|
+
Requires-Dist: browser-cookie3
|
|
23
|
+
Requires-Dist: fake-useragent
|
|
24
|
+
Requires-Dist: platformdirs
|
|
25
|
+
Requires-Dist: yarl
|
|
26
|
+
Project-URL: Repository, https://github.com/twilligon/claude-backup
|
|
27
|
+
|
|
28
|
+
# `claude-backup`
|
|
29
|
+
|
|
30
|
+
Unofficial, unsanctioned tool to backup [Claude.ai](https://claude.ai) chats to local files.
|
|
31
|
+
|
|
32
|
+
uvx claude-backup
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
`claude-backup` creates a full local copy of all (text) content of all branches of all chats accessible to your [Claude.ai](https://claude.ai) account. If you are a member of multiple "organizations", it fetches chats from all of them. We preserve all metadata on chats and their provenance, including that of their parent organization and user. We automatically rename our local copies of chats and organizations to match their current names on `claude.ai`.
|
|
37
|
+
|
|
38
|
+
We use an incremental sync algorithm to fetch only chats created or updated since the last backup. The fetch is done in parallel, with a typical user agent and polite rate and connection limits such that it's less traffic than manually scrolling through your chats and opening each in a new browser tab. I of course can't guarantee Big Claude won't be after you if you run this unofficial tool, but empirically they don't seem to mind.
|
|
39
|
+
|
|
40
|
+
Chats are stored as their original API JSON with nice `find`able names and `grep`able contents:
|
|
41
|
+
|
|
42
|
+
$ CLAUDE_SESSION_KEY="$(wl-paste)" uvx claude-backup
|
|
43
|
+
Skipping organization twilligon (c8eaca6b-eddb-4bbc-9fe3-637a0574565f) without "chat" capability
|
|
44
|
+
Fetching chats for organization claude@twilligon.com's Organization (9e9a56fc-6d1c-4d62-a96d-0cff3a473cf0)
|
|
45
|
+
30ceebd6-afcc-4796-bb77-631069cd0696 Cadre versus posse comparison
|
|
46
|
+
d15ac7d6-f167-43d3-afac-fcfaaafb64ec GraphQL database backends and data sources
|
|
47
|
+
3e553492-89a8-45e8-b51a-b2faf9dfde64 Japanese sword quality despite poor iron sources
|
|
48
|
+
040343e8-db5a-4031-a21a-be237a6c661a Balisong pin and screw maintenance
|
|
49
|
+
08217feb-c912-40c2-9d14-f89784d61ab5 Fixing dry falafel centers
|
|
50
|
+
d41bf95e-8da1-47b3-af89-aecacd7770a6 Sleep Token's artistic merits
|
|
51
|
+
b10e02dd-479b-4714-9d99-264d6ef4ba75 Annual human steel consumption
|
|
52
|
+
608f7e3d-fbcc-4891-bf67-ebc9f15c7a01 Calling payphones from mobile devices
|
|
53
|
+
c56ad0c5-feae-4dae-bafc-784d1f46de29 Postfix security assessment
|
|
54
|
+
4553fae5-61a6-40fc-b95c-36c53e706614 App store review power dynamics for major companies
|
|
55
|
+
0b7f4ae8-ef57-4cac-8d47-7e4c5b0e5564 Exercise timing and sleep quality
|
|
56
|
+
6e5385c4-6ad4-4d46-ac20-dda2105a3bea Scented neural networks with odor emissions
|
|
57
|
+
$ # ...and so on... time passes... then later:
|
|
58
|
+
$ CLAUDE_SESSION_KEY="$(wl-paste)" uvx claude-backup
|
|
59
|
+
Skipping organization twilligon (c8eaca6b-eddb-4bbc-9fe3-637a0574565f) without "chat" capability
|
|
60
|
+
Fetching chats for organization claude@twilligon.com's Organization (9e9a56fc-6d1c-4d62-a96d-0cff3a473cf0)
|
|
61
|
+
4ddbcc12-5cd8-4611-813a-befdedeb4b16 Smithsonian funding and government ownership
|
|
62
|
+
$ tree ~/.local/share/claude-backup | head -n15
|
|
63
|
+
~/.local/share/claude-backup
|
|
64
|
+
├── account.json
|
|
65
|
+
├── organizations
|
|
66
|
+
│ └── claude@twilligon.com's_Organization-9e9a56fc-6d1c-4d62-a96d-0cff3a473cf0
|
|
67
|
+
│ ├── chat_conversations
|
|
68
|
+
│ │ ├── Free_Indirect_Discourse_Analysis-48d70be1-f23d-4757-9bcf-9d9d9711a3f6.json
|
|
69
|
+
│ │ ├── Fetty_Wap_name_origin-dc45880a-8c60-4366-b610-e4fe6bb9a65c.json
|
|
70
|
+
│ │ ├── Ryzen_Motherboard_PS_2_Port_Hunt-012583f0-83cc-4c18-8f8b-312c8cb856ac.json
|
|
71
|
+
│ │ ├── Tailscale_versus_wireguard_comparison-24ed7155-8d9e-410f-bf7c-cd3fb6cb4379.json
|
|
72
|
+
│ │ ├── Credit_card_companies_in_Europe-67ad5f75-80ba-4754-bc6c-7d21e98f948c.json
|
|
73
|
+
│ │ ├── OpenGL_and_Vulkan_Package_Compatibility-63859641-5ffe-459b-99b0-4759acdc8235.json
|
|
74
|
+
│ │ ├── Government_tech_capabilities_and_bureaucracy-1c0743f0-a124-456b-888f-d08c5b83923b.json
|
|
75
|
+
│ │ ├── Reverse_Engineering_Minified_JavaScript-8cf7cab1-9576-45d7-929a-ea34997b0061.json
|
|
76
|
+
│ │ ├── Wire_and_String_Mysteries-9ac747b7-f36e-4e86-9f24-377ab16fb5ec.json
|
|
77
|
+
│ │ ├── US_Senate_parliamentarian's_role_and_power-5fa34eb3-ac74-4683-8850-c90761e5f3d8.json
|
|
78
|
+
$ rg -0l falafel ~/.local/share/claude-backup/organizations/*/chat_conversations | xargs -0n1 basename
|
|
79
|
+
Fixing_dry_falafel_centers-08217feb-c912-40c2-9d14-f89784d61ab5.json
|
|
80
|
+
Best_falafel_restaurants_in_San_Francisco-76aa159a-e41a-4935-a2e5-d53465041e13.json
|
|
81
|
+
Rainy_day_food_delivery_dilemma-db4992e8-c69c-4085-a571-9a22dfff68da.json
|
|
82
|
+
Pita_Chip_Conversation_Search-059dca9c-bac3-4cd5-b405-34ddbbdd5fa8.json
|
|
83
|
+
$ rg -0l falafel ~/.local/share/claude-backup/organizations/*/chat_conversations | xargs -0 jq -r '"https://claude.ai/chat/\(.uuid)"'
|
|
84
|
+
https://claude.ai/chat/08217feb-c912-40c2-9d14-f89784d61ab5
|
|
85
|
+
https://claude.ai/chat/76aa159a-e41a-4935-a2e5-d53465041e13
|
|
86
|
+
https://claude.ai/chat/db4992e8-c69c-4085-a571-9a22dfff68da
|
|
87
|
+
https://claude.ai/chat/059dca9c-bac3-4cd5-b405-34ddbbdd5fa8
|
|
88
|
+
|
|
89
|
+
## Limitations
|
|
90
|
+
|
|
91
|
+
This read-only tool is the product of reverse-engineering Claude.ai's internal API (for Good, not Evil---please don't ban me Anthropic 🙏) so I can't make any guarantees `claude-backup` will continue to work. That said, we make very few assumptions about the API schema, and everything works as of 2025-10-31. I'll likely update this best-effort when things break. Barring that, PRs welcome ;)
|
|
92
|
+
|
|
93
|
+
For reliable and comprehensive backups even through minor API changes, we save raw JSON responses from the API instead of normalizing them to some fixed schema. This should be a bit more resilient than forcing everything into some internal data model that could diverge from that of Claude.ai, but it means we don't download resources referenced by API objects other than what's necessary to list and fetch chat text. In practice, this preserves all textual message content and text/markdown attachments, but not images, PDFs, container uploads, "advanced research" reports, etc.
|
|
94
|
+
|
|
95
|
+
As a backup tool, we **retain deleted chats** (and old branches of extant chats) by default. To delete local copies, manually delete the corresponding `.json` from `backup_dir` or start from scratch by deleting `backup_dir` or running `claude-backup --ignore-cache`.
|
|
96
|
+
|
|
97
|
+
By default, `claude-backup` attempts to authenticate to `claude.ai` by extracting a session cookie from your browser. If this doesn't work (and frankly if this does work you should be sandboxing things better!) you must manually do the same. For Chrome et al., to https://claude.ai in your browser, open **Developer tools** with F12 or Ctrl+Shift+I, navigate to the **Application** tab (it may be hidden under **⋮** > **More tools** > **Application**), and copy the value of the `sessionKey` cookie. (Firefox should be [similar](https://firefox-source-docs.mozilla.org/devtools-user/storage_inspector/index.html).) Then set the `CLAUDE_SESSION_KEY` environment variable to this cookie when running `claude-backup`:
|
|
98
|
+
|
|
99
|
+
$ CLAUDE_SESSION_KEY="sk-ant-sid01-..." claude-backup
|
|
100
|
+
|
|
101
|
+
As this tool demonstrates **anyone with this cookie is authenticated as you on `claude.ai`** so be careful and never give this to anyone or anything you do not trust! It might even be worth keeping out of `history` by loading it straight from your clipboard with e.g. `CLAUDE_SESSION_KEY="$(wl-paste)"`, though the exact command varies by platform. I'm sure Claude knows which you should use ;)
|
|
102
|
+
|
|
103
|
+
As of recently(?) `claude.ai` is behind Cloudflare, and this no longer works great without VPNs. I swore to myself I was off the scrape-things-that-don't-want-to-be-scraped grind, so I recommend running `claude-backup` from a non-sus IP, bumping `--success-delay`, and lowering `--connections`. Any further workarounds are left as an exercise to the reader...
|
|
104
|
+
|
|
105
|
+
## Install
|
|
106
|
+
|
|
107
|
+
The blazing fast and memory safe way:
|
|
108
|
+
|
|
109
|
+
$ uvx claude-backup # installed on demand
|
|
110
|
+
|
|
111
|
+
The traditional way:
|
|
112
|
+
|
|
113
|
+
$ pip install claude-backup
|
|
114
|
+
$ claude-backup
|
|
115
|
+
|
|
116
|
+
The bleeding-edge way:
|
|
117
|
+
|
|
118
|
+
$ git clone https://github.com/twilligon/claude-backup
|
|
119
|
+
$ cd claude-backup
|
|
120
|
+
$ python3 -m venv venv; . venv/bin/activate # you probably want a venv
|
|
121
|
+
$ pip install -e .
|
|
122
|
+
$ claude-backup
|
|
123
|
+
|
|
124
|
+
## Usage
|
|
125
|
+
|
|
126
|
+
$ claude-backup --help
|
|
127
|
+
usage: claude-backup [-h] [-v] [-c CONNECTIONS] [-d DELAY] [-r RETRIES]
|
|
128
|
+
[--min-retry-delay DELAY] [--max-retry-delay DELAY]
|
|
129
|
+
[--ignore-cache]
|
|
130
|
+
[backup_dir]
|
|
131
|
+
|
|
132
|
+
Backup Claude.ai chats
|
|
133
|
+
|
|
134
|
+
positional arguments:
|
|
135
|
+
backup_dir Directory to save backups (default:
|
|
136
|
+
~/.local/share/claude-backup)
|
|
137
|
+
|
|
138
|
+
options:
|
|
139
|
+
-h, --help show this help message and exit
|
|
140
|
+
-v, --version show program's version number and exit
|
|
141
|
+
-c, --connections CONNECTIONS
|
|
142
|
+
Maximum concurrent connections (default: 6)
|
|
143
|
+
-d, --success-delay DELAY
|
|
144
|
+
Delay after successful request in seconds (default:
|
|
145
|
+
0.25)
|
|
146
|
+
-r, --retries RETRIES
|
|
147
|
+
Number of retries for API requests (default: 10)
|
|
148
|
+
--min-retry-delay DELAY
|
|
149
|
+
Minimum retry delay in seconds (default: 1.0)
|
|
150
|
+
--max-retry-delay DELAY
|
|
151
|
+
Maximum retry delay in seconds (default: 60.0)
|
|
152
|
+
--ignore-cache Ignore local cache and re-fetch everything from API
|
|
153
|
+
(default: False)
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
`claude-backup` is dedicated to the public domain where possible via CC0-1.0.
|
|
158
|
+
|
|
159
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
160
|
+
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# `claude-backup`
|
|
2
|
+
|
|
3
|
+
Unofficial, unsanctioned tool to backup [Claude.ai](https://claude.ai) chats to local files.
|
|
4
|
+
|
|
5
|
+
uvx claude-backup
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
`claude-backup` creates a full local copy of all (text) content of all branches of all chats accessible to your [Claude.ai](https://claude.ai) account. If you are a member of multiple "organizations", it fetches chats from all of them. We preserve all metadata on chats and their provenance, including that of their parent organization and user. We automatically rename our local copies of chats and organizations to match their current names on `claude.ai`.
|
|
10
|
+
|
|
11
|
+
We use an incremental sync algorithm to fetch only chats created or updated since the last backup. The fetch is done in parallel, with a typical user agent and polite rate and connection limits such that it's less traffic than manually scrolling through your chats and opening each in a new browser tab. I of course can't guarantee Big Claude won't be after you if you run this unofficial tool, but empirically they don't seem to mind.
|
|
12
|
+
|
|
13
|
+
Chats are stored as their original API JSON with nice `find`able names and `grep`able contents:
|
|
14
|
+
|
|
15
|
+
$ CLAUDE_SESSION_KEY="$(wl-paste)" uvx claude-backup
|
|
16
|
+
Skipping organization twilligon (c8eaca6b-eddb-4bbc-9fe3-637a0574565f) without "chat" capability
|
|
17
|
+
Fetching chats for organization claude@twilligon.com's Organization (9e9a56fc-6d1c-4d62-a96d-0cff3a473cf0)
|
|
18
|
+
30ceebd6-afcc-4796-bb77-631069cd0696 Cadre versus posse comparison
|
|
19
|
+
d15ac7d6-f167-43d3-afac-fcfaaafb64ec GraphQL database backends and data sources
|
|
20
|
+
3e553492-89a8-45e8-b51a-b2faf9dfde64 Japanese sword quality despite poor iron sources
|
|
21
|
+
040343e8-db5a-4031-a21a-be237a6c661a Balisong pin and screw maintenance
|
|
22
|
+
08217feb-c912-40c2-9d14-f89784d61ab5 Fixing dry falafel centers
|
|
23
|
+
d41bf95e-8da1-47b3-af89-aecacd7770a6 Sleep Token's artistic merits
|
|
24
|
+
b10e02dd-479b-4714-9d99-264d6ef4ba75 Annual human steel consumption
|
|
25
|
+
608f7e3d-fbcc-4891-bf67-ebc9f15c7a01 Calling payphones from mobile devices
|
|
26
|
+
c56ad0c5-feae-4dae-bafc-784d1f46de29 Postfix security assessment
|
|
27
|
+
4553fae5-61a6-40fc-b95c-36c53e706614 App store review power dynamics for major companies
|
|
28
|
+
0b7f4ae8-ef57-4cac-8d47-7e4c5b0e5564 Exercise timing and sleep quality
|
|
29
|
+
6e5385c4-6ad4-4d46-ac20-dda2105a3bea Scented neural networks with odor emissions
|
|
30
|
+
$ # ...and so on... time passes... then later:
|
|
31
|
+
$ CLAUDE_SESSION_KEY="$(wl-paste)" uvx claude-backup
|
|
32
|
+
Skipping organization twilligon (c8eaca6b-eddb-4bbc-9fe3-637a0574565f) without "chat" capability
|
|
33
|
+
Fetching chats for organization claude@twilligon.com's Organization (9e9a56fc-6d1c-4d62-a96d-0cff3a473cf0)
|
|
34
|
+
4ddbcc12-5cd8-4611-813a-befdedeb4b16 Smithsonian funding and government ownership
|
|
35
|
+
$ tree ~/.local/share/claude-backup | head -n15
|
|
36
|
+
~/.local/share/claude-backup
|
|
37
|
+
├── account.json
|
|
38
|
+
├── organizations
|
|
39
|
+
│ └── claude@twilligon.com's_Organization-9e9a56fc-6d1c-4d62-a96d-0cff3a473cf0
|
|
40
|
+
│ ├── chat_conversations
|
|
41
|
+
│ │ ├── Free_Indirect_Discourse_Analysis-48d70be1-f23d-4757-9bcf-9d9d9711a3f6.json
|
|
42
|
+
│ │ ├── Fetty_Wap_name_origin-dc45880a-8c60-4366-b610-e4fe6bb9a65c.json
|
|
43
|
+
│ │ ├── Ryzen_Motherboard_PS_2_Port_Hunt-012583f0-83cc-4c18-8f8b-312c8cb856ac.json
|
|
44
|
+
│ │ ├── Tailscale_versus_wireguard_comparison-24ed7155-8d9e-410f-bf7c-cd3fb6cb4379.json
|
|
45
|
+
│ │ ├── Credit_card_companies_in_Europe-67ad5f75-80ba-4754-bc6c-7d21e98f948c.json
|
|
46
|
+
│ │ ├── OpenGL_and_Vulkan_Package_Compatibility-63859641-5ffe-459b-99b0-4759acdc8235.json
|
|
47
|
+
│ │ ├── Government_tech_capabilities_and_bureaucracy-1c0743f0-a124-456b-888f-d08c5b83923b.json
|
|
48
|
+
│ │ ├── Reverse_Engineering_Minified_JavaScript-8cf7cab1-9576-45d7-929a-ea34997b0061.json
|
|
49
|
+
│ │ ├── Wire_and_String_Mysteries-9ac747b7-f36e-4e86-9f24-377ab16fb5ec.json
|
|
50
|
+
│ │ ├── US_Senate_parliamentarian's_role_and_power-5fa34eb3-ac74-4683-8850-c90761e5f3d8.json
|
|
51
|
+
$ rg -0l falafel ~/.local/share/claude-backup/organizations/*/chat_conversations | xargs -0n1 basename
|
|
52
|
+
Fixing_dry_falafel_centers-08217feb-c912-40c2-9d14-f89784d61ab5.json
|
|
53
|
+
Best_falafel_restaurants_in_San_Francisco-76aa159a-e41a-4935-a2e5-d53465041e13.json
|
|
54
|
+
Rainy_day_food_delivery_dilemma-db4992e8-c69c-4085-a571-9a22dfff68da.json
|
|
55
|
+
Pita_Chip_Conversation_Search-059dca9c-bac3-4cd5-b405-34ddbbdd5fa8.json
|
|
56
|
+
$ rg -0l falafel ~/.local/share/claude-backup/organizations/*/chat_conversations | xargs -0 jq -r '"https://claude.ai/chat/\(.uuid)"'
|
|
57
|
+
https://claude.ai/chat/08217feb-c912-40c2-9d14-f89784d61ab5
|
|
58
|
+
https://claude.ai/chat/76aa159a-e41a-4935-a2e5-d53465041e13
|
|
59
|
+
https://claude.ai/chat/db4992e8-c69c-4085-a571-9a22dfff68da
|
|
60
|
+
https://claude.ai/chat/059dca9c-bac3-4cd5-b405-34ddbbdd5fa8
|
|
61
|
+
|
|
62
|
+
## Limitations
|
|
63
|
+
|
|
64
|
+
This read-only tool is the product of reverse-engineering Claude.ai's internal API (for Good, not Evil---please don't ban me Anthropic 🙏) so I can't make any guarantees `claude-backup` will continue to work. That said, we make very few assumptions about the API schema, and everything works as of 2025-10-31. I'll likely update this best-effort when things break. Barring that, PRs welcome ;)
|
|
65
|
+
|
|
66
|
+
For reliable and comprehensive backups even through minor API changes, we save raw JSON responses from the API instead of normalizing them to some fixed schema. This should be a bit more resilient than forcing everything into some internal data model that could diverge from that of Claude.ai, but it means we don't download resources referenced by API objects other than what's necessary to list and fetch chat text. In practice, this preserves all textual message content and text/markdown attachments, but not images, PDFs, container uploads, "advanced research" reports, etc.
|
|
67
|
+
|
|
68
|
+
As a backup tool, we **retain deleted chats** (and old branches of extant chats) by default. To delete local copies, manually delete the corresponding `.json` from `backup_dir` or start from scratch by deleting `backup_dir` or running `claude-backup --ignore-cache`.
|
|
69
|
+
|
|
70
|
+
By default, `claude-backup` attempts to authenticate to `claude.ai` by extracting a session cookie from your browser. If this doesn't work (and frankly if this does work you should be sandboxing things better!) you must manually do the same. For Chrome et al., to https://claude.ai in your browser, open **Developer tools** with F12 or Ctrl+Shift+I, navigate to the **Application** tab (it may be hidden under **⋮** > **More tools** > **Application**), and copy the value of the `sessionKey` cookie. (Firefox should be [similar](https://firefox-source-docs.mozilla.org/devtools-user/storage_inspector/index.html).) Then set the `CLAUDE_SESSION_KEY` environment variable to this cookie when running `claude-backup`:
|
|
71
|
+
|
|
72
|
+
$ CLAUDE_SESSION_KEY="sk-ant-sid01-..." claude-backup
|
|
73
|
+
|
|
74
|
+
As this tool demonstrates **anyone with this cookie is authenticated as you on `claude.ai`** so be careful and never give this to anyone or anything you do not trust! It might even be worth keeping out of `history` by loading it straight from your clipboard with e.g. `CLAUDE_SESSION_KEY="$(wl-paste)"`, though the exact command varies by platform. I'm sure Claude knows which you should use ;)
|
|
75
|
+
|
|
76
|
+
As of recently(?) `claude.ai` is behind Cloudflare, and this no longer works great without VPNs. I swore to myself I was off the scrape-things-that-don't-want-to-be-scraped grind, so I recommend running `claude-backup` from a non-sus IP, bumping `--success-delay`, and lowering `--connections`. Any further workarounds are left as an exercise to the reader...
|
|
77
|
+
|
|
78
|
+
## Install
|
|
79
|
+
|
|
80
|
+
The blazing fast and memory safe way:
|
|
81
|
+
|
|
82
|
+
$ uvx claude-backup # installed on demand
|
|
83
|
+
|
|
84
|
+
The traditional way:
|
|
85
|
+
|
|
86
|
+
$ pip install claude-backup
|
|
87
|
+
$ claude-backup
|
|
88
|
+
|
|
89
|
+
The bleeding-edge way:
|
|
90
|
+
|
|
91
|
+
$ git clone https://github.com/twilligon/claude-backup
|
|
92
|
+
$ cd claude-backup
|
|
93
|
+
$ python3 -m venv venv; . venv/bin/activate # you probably want a venv
|
|
94
|
+
$ pip install -e .
|
|
95
|
+
$ claude-backup
|
|
96
|
+
|
|
97
|
+
## Usage
|
|
98
|
+
|
|
99
|
+
$ claude-backup --help
|
|
100
|
+
usage: claude-backup [-h] [-v] [-c CONNECTIONS] [-d DELAY] [-r RETRIES]
|
|
101
|
+
[--min-retry-delay DELAY] [--max-retry-delay DELAY]
|
|
102
|
+
[--ignore-cache]
|
|
103
|
+
[backup_dir]
|
|
104
|
+
|
|
105
|
+
Backup Claude.ai chats
|
|
106
|
+
|
|
107
|
+
positional arguments:
|
|
108
|
+
backup_dir Directory to save backups (default:
|
|
109
|
+
~/.local/share/claude-backup)
|
|
110
|
+
|
|
111
|
+
options:
|
|
112
|
+
-h, --help show this help message and exit
|
|
113
|
+
-v, --version show program's version number and exit
|
|
114
|
+
-c, --connections CONNECTIONS
|
|
115
|
+
Maximum concurrent connections (default: 6)
|
|
116
|
+
-d, --success-delay DELAY
|
|
117
|
+
Delay after successful request in seconds (default:
|
|
118
|
+
0.25)
|
|
119
|
+
-r, --retries RETRIES
|
|
120
|
+
Number of retries for API requests (default: 10)
|
|
121
|
+
--min-retry-delay DELAY
|
|
122
|
+
Minimum retry delay in seconds (default: 1.0)
|
|
123
|
+
--max-retry-delay DELAY
|
|
124
|
+
Maximum retry delay in seconds (default: 60.0)
|
|
125
|
+
--ignore-cache Ignore local cache and re-fetch everything from API
|
|
126
|
+
(default: False)
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
`claude-backup` is dedicated to the public domain where possible via CC0-1.0.
|
|
131
|
+
|
|
132
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|