reasonwork 0.4.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 (31) hide show
  1. reasonwork-0.4.0/LICENSE +52 -0
  2. reasonwork-0.4.0/MANIFEST.in +12 -0
  3. reasonwork-0.4.0/PKG-INFO +144 -0
  4. reasonwork-0.4.0/PYPI_README.md +125 -0
  5. reasonwork-0.4.0/pyproject.toml +67 -0
  6. reasonwork-0.4.0/setup.cfg +4 -0
  7. reasonwork-0.4.0/src/reasonwork.egg-info/PKG-INFO +144 -0
  8. reasonwork-0.4.0/src/reasonwork.egg-info/SOURCES.txt +29 -0
  9. reasonwork-0.4.0/src/reasonwork.egg-info/dependency_links.txt +1 -0
  10. reasonwork-0.4.0/src/reasonwork.egg-info/entry_points.txt +2 -0
  11. reasonwork-0.4.0/src/reasonwork.egg-info/requires.txt +7 -0
  12. reasonwork-0.4.0/src/reasonwork.egg-info/top_level.txt +1 -0
  13. reasonwork-0.4.0/src/reasonwork_exchange/__init__.py +3 -0
  14. reasonwork-0.4.0/src/reasonwork_exchange/__main__.py +6 -0
  15. reasonwork-0.4.0/src/reasonwork_exchange/analyzer.py +908 -0
  16. reasonwork-0.4.0/src/reasonwork_exchange/auth.py +47 -0
  17. reasonwork-0.4.0/src/reasonwork_exchange/cli/__init__.py +55 -0
  18. reasonwork-0.4.0/src/reasonwork_exchange/cli/config.py +89 -0
  19. reasonwork-0.4.0/src/reasonwork_exchange/cli/login.py +39 -0
  20. reasonwork-0.4.0/src/reasonwork_exchange/cli/scan.py +99 -0
  21. reasonwork-0.4.0/src/reasonwork_exchange/cli/schedule.py +140 -0
  22. reasonwork-0.4.0/src/reasonwork_exchange/cli/sync.py +317 -0
  23. reasonwork-0.4.0/src/reasonwork_exchange/cli/update.py +177 -0
  24. reasonwork-0.4.0/src/reasonwork_exchange/cli/upload.py +95 -0
  25. reasonwork-0.4.0/src/reasonwork_exchange/client.py +273 -0
  26. reasonwork-0.4.0/src/reasonwork_exchange/config.py +70 -0
  27. reasonwork-0.4.0/src/reasonwork_exchange/discovery.py +59 -0
  28. reasonwork-0.4.0/src/reasonwork_exchange/errors.py +59 -0
  29. reasonwork-0.4.0/src/reasonwork_exchange/output.py +73 -0
  30. reasonwork-0.4.0/src/reasonwork_exchange/state.py +249 -0
  31. reasonwork-0.4.0/src/reasonwork_exchange/version_check.py +63 -0
@@ -0,0 +1,52 @@
1
+ Copyright (c) 2026 ReasonworkAI, Inc. All rights reserved.
2
+
3
+ This software ("reasonwork", the Reasonwork CLI) and its accompanying
4
+ documentation are the proprietary property of
5
+ ReasonworkAI, Inc. ("ReasonworkAI"). No license, right, or interest in this
6
+ software is granted except as expressly set out below.
7
+
8
+ 1. LIMITED LICENSE TO USE
9
+ ReasonworkAI grants you a personal, non-exclusive, non-transferable,
10
+ revocable, royalty-free license to install and run this software solely
11
+ for the purpose of discovering, inspecting, and submitting your own
12
+ session data to the Reasonwork Contributor Exchange, subject to the
13
+ Contributor Exchange's Platform Terms of Use and any other agreement
14
+ between you and ReasonworkAI governing that use.
15
+
16
+ 2. RESTRICTIONS
17
+ Except as expressly permitted in Section 1, you may not, and may not
18
+ permit any third party to:
19
+ (a) copy, modify, adapt, translate, or create derivative works of this
20
+ software;
21
+ (b) redistribute, sublicense, sell, rent, lease, or otherwise transfer
22
+ this software or access to it, in whole or in part;
23
+ (c) reverse engineer, decompile, disassemble, or otherwise attempt to
24
+ derive the source code of any portion of this software not already
25
+ provided in source form, or use this software to build a competing
26
+ product or service;
27
+ (d) remove, obscure, or alter any copyright, trademark, or other
28
+ proprietary notice affixed to this software.
29
+
30
+ 3. NO OTHER RIGHTS
31
+ All rights not expressly granted in Section 1 are reserved by ReasonworkAI.
32
+ Nothing in this license transfers any right, title, or interest in this
33
+ software, including any patent, trademark, trade secret, or other
34
+ intellectual property right.
35
+
36
+ 4. DISCLAIMER OF WARRANTY
37
+ THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
38
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
39
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
40
+
41
+ 5. LIMITATION OF LIABILITY
42
+ IN NO EVENT SHALL REASONWORKAI BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
43
+ LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THIS SOFTWARE OR
44
+ ITS USE.
45
+
46
+ 6. TERMINATION
47
+ This license terminates automatically if you breach any of its terms.
48
+ Upon termination, you must stop using and delete all copies of this
49
+ software in your possession.
50
+
51
+ "Reasonwork" and "ReasonworkAI" are trademarks of
52
+ ReasonworkAI, Inc. This license does not grant any right to use those marks.
@@ -0,0 +1,12 @@
1
+ # The internal README documents real internal infra (staging hostname, real
2
+ # env var names, real local config paths) that's fine in this private repo
3
+ # but shouldn't ship in a publicly downloadable package -- PYPI_README.md
4
+ # (referenced by pyproject.toml's `readme`) is the public-facing doc instead.
5
+ exclude README.md
6
+
7
+ # Tests aren't needed at runtime and reference the same real internal paths
8
+ # (e.g. the actual local auth-file location, tested
9
+ # directly) -- correct as source-controlled tests, not meant to ship in a
10
+ # publicly downloadable sdist.
11
+ recursive-exclude tests *
12
+ prune tests
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: reasonwork
3
+ Version: 0.4.0
4
+ Summary: Reasonwork CLI: safely contribute Codex, Claude Code, and Cursor trajectories to Reasonwork.
5
+ Author: ReasonworkAI, Inc.
6
+ License-Expression: LicenseRef-Proprietary
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Python: >=3.12
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: rich>=13.0
13
+ Requires-Dist: typer>=0.12
14
+ Provides-Extra: worker
15
+ Requires-Dist: boto3>=1.35; extra == "worker"
16
+ Requires-Dist: litellm>=1.50; extra == "worker"
17
+ Requires-Dist: supabase<3,>=2.0; extra == "worker"
18
+ Dynamic: license-file
19
+
20
+ # Reasonwork — CLI + Claude Code plugin
21
+
22
+ Turn your Claude Code, Codex, or Cursor CLI sessions into reviewed, priced, paid contributions to Reasonwork — automatically, with privacy checks running locally before anything ever leaves your machine.
23
+
24
+ Your dashboard, settings, and token creation all live on the Reasonwork web app — sign in there to get started and to check your own submissions.
25
+
26
+ ## Requirements
27
+
28
+ - macOS (background auto-sync via `launchd` is macOS-only today; on Linux you can still use the CLI manually or wire your own systemd timer/cron entry).
29
+ - Python 3.12+.
30
+ - [`uv`](https://docs.astral.sh/uv/) for installing the CLI as a tool.
31
+ - Claude Code, if you want the plugin (hooks + slash commands) instead of running the CLI by hand.
32
+ - Codex, if you want the Codex hook + skill instead — unlike Claude Code, this install path is not yet verified end-to-end against a live Codex install.
33
+ - Cursor (the `cursor-agent` CLI, not the IDE chat panel), if you want the Cursor hook + skill instead — also not yet verified end-to-end against a live Cursor install, and depends on your installed Cursor version supporting the `sessionStart`/`sessionEnd` hook events.
34
+ - A Reasonwork account and an `nxc_…` contributor token, created from your account's settings page.
35
+
36
+ ## 1. Install the CLI
37
+
38
+ ```bash
39
+ pip install reasonwork
40
+ reasonwork --help
41
+ ```
42
+
43
+ ### Updating
44
+
45
+ ```bash
46
+ reasonwork update
47
+ ```
48
+
49
+ Detects how you installed it (pip/pipx/uv tool, or an editable install from a git checkout) and upgrades accordingly.
50
+
51
+ ## 2. Log in
52
+
53
+ Create a contributor token from your account's settings page, then store it locally:
54
+
55
+ ```bash
56
+ reasonwork login --token nxc_xxxxxxxx
57
+ ```
58
+
59
+ The token is written to a local config file (mode `0600`, owner read/write only). Use `login --dry-run` to just verify a token works without writing it to disk.
60
+
61
+ ## 3. Install the Claude Code plugin (recommended)
62
+
63
+ The plugin is what makes this hands-off: it hooks into Claude Code's session lifecycle so you don't have to remember to run `sync` yourself. It isn't published to a public marketplace — ask your Reasonwork contact for the marketplace source to add.
64
+
65
+ Once installed, it wires up:
66
+
67
+ | Hook | Fires on | What it does |
68
+ |---|---|---|
69
+ | `SessionEnd` | Every Claude Code session (and subagent) ending | Refreshes the local session index (`scan`). If `sharing_mode=all`, also runs `sync --yes` in the background to submit anything new. Never blocks session exit, never errors if the CLI isn't installed. |
70
+ | `SessionStart` | Every new session | If `sharing_mode=ask`, checks for pending unsynced sessions and nudges you. Uploads nothing on its own. |
71
+
72
+ And two slash commands: `/exchange-status` (read-only summary of your sharing settings and pending sessions) and `/exchange-sync` (shows exactly what would be submitted, asks for confirmation, then submits only if you confirm).
73
+
74
+ ## 4. Codex and Cursor (optional)
75
+
76
+ Both integrations work the same way: a local install script wires up a session-end/session-start hook and a skill, scoped entirely to that tool's own config directory — never touching anything Claude-Code-related. Neither is yet verified end-to-end against a live install; treat as best-effort. See your Reasonwork contact for the install scripts if you use Codex or Cursor CLI.
77
+
78
+ ## Turning on auto-capture (`sharing_mode`)
79
+
80
+ | Mode | Behavior |
81
+ |---|---|
82
+ | `none` | Nothing is scanned or submitted automatically. Manual `upload`/`sync` still works if you run it yourself. |
83
+ | `ask` *(default)* | Sessions are indexed locally, but nothing uploads without you confirming. |
84
+ | `all` | Full auto-capture: every session, at `SessionEnd`, is scanned and synced automatically — no prompt. |
85
+
86
+ ```bash
87
+ reasonwork config set --sharing-mode all
88
+ reasonwork config exclude --source codex # exclude a source or --path, add --remove to undo
89
+ reasonwork config show # check current settings
90
+ ```
91
+
92
+ ### Optional: scheduled background sync outside of Claude Code (macOS only)
93
+
94
+ ```bash
95
+ reasonwork schedule install --interval-minutes 30
96
+ reasonwork schedule status
97
+ reasonwork schedule uninstall
98
+ ```
99
+
100
+ ## CLI commands
101
+
102
+ | Command | Purpose |
103
+ |---|---|
104
+ | `reasonwork login --token nxc_…` | Verify and store your contributor token. |
105
+ | `reasonwork scan` | Discover local Claude Code/Codex/Cursor sessions and show metadata-only checks. Never uploads. |
106
+ | `reasonwork sync` | Submit every newly discovered, consented session not already recorded in the local ledger. |
107
+ | `reasonwork upload --path … --source … --confirm-rights` | Manually run the safety checks and upload a single specific file. |
108
+ | `reasonwork config show / set / exclude` | Inspect and adjust local sharing consent. |
109
+ | `reasonwork schedule install / status / uninstall` | Manage the optional macOS background timer. |
110
+ | `reasonwork update` | Upgrade to the latest version, however you installed it. |
111
+
112
+ Useful flags across most commands: `--dry-run` (preview only), `--json` (stable JSON output for scripting), `--yes` (skip the confirmation prompt on `sync`/`schedule install`).
113
+
114
+ ## Features
115
+
116
+ - **Local-first privacy scanning.** Every session is analyzed on your machine before anything uploads: secret detection (private keys, basic-auth URLs, API keys, etc.), email/phone PII counts, and an overall `privacy_risk` rating. A `blocked`/`high`/`medium` risk session is **rejected locally and never uploaded** — only a metadata-only rejection report is sent to the server for operator visibility, never the file content.
117
+ - **Exact-hash dedup and duplicate-content detection.** A session already submitted once is never re-submitted, even across renamed/moved files or when a *different* file's content turns out to be a byte-exact prefix of something already known (e.g. a session resumed, copied, or exported to a new location).
118
+ - **Subagent session recording**, across all three sources, each judged, priced, and paid independently of its parent session.
119
+ - **Server-side quality scoring and automatic pricing** based on privacy risk and content quality — the scoring/pricing logic itself is deliberately not part of this package, so it can't be reverse-engineered from a local install and gamed.
120
+ - **Full contributor data controls** — export your records, delete unaccepted raw submissions, and file tracked privacy requests (access, correction, deletion, restriction, opt-out) from your dashboard.
121
+
122
+ ## How it works end-to-end
123
+
124
+ 1. **Discover** — `scan`/`sync` find Claude Code, Codex, and Cursor session files (`.jsonl`) locally, including subagent transcripts.
125
+ 2. **Analyze locally** — for each new/changed file: parse JSONL, count messages/tool calls/tool results, run secret + PII detection, and decide a privacy risk level. Quality scoring itself happens server-side only.
126
+ 3. **Local gate** — if privacy risk is `medium`/`high`/`blocked`, or the file's content is a duplicate/contained-duplicate of something already known, it's rejected/skipped *before upload*, with only metadata reported to the server.
127
+ 4. **Upload** — anything that passes the local gate is uploaded.
128
+ 5. **Worker intake** — a backend worker re-runs the same deterministic analysis server-side, optionally adds an LLM ("semantic") quality judgment, and finalizes the record's status and price.
129
+ 6. **Review** — an operator reviews priced/quarantined items and accepts or rejects.
130
+ 7. **Payout** — accepted items get queued and paid out.
131
+
132
+ ## How scoring and pricing actually work
133
+
134
+ Quality scoring and pricing are computed **server-side only**, from a fresh re-download of what you actually uploaded — never trusted from anything this CLI reports about itself. That's deliberate: the exact formula (score weights, anti-gaming thresholds, price bands) lives only in the private backend, specifically so it can't be reverse-engineered and gamed by anyone who's installed this package.
135
+
136
+ At a high level, without exact numbers: a session earns credit for genuine tool diversity, real code edits (not just reads), substantive messages, and recovering from tool errors; sessions that look padded or that loop the same trivial tool call with no real edits score worse. An optional LLM pass can add a small bonus on top for sessions that clear every check, but it can never rescue a below-floor score or exceed the overall offer cap. New contributors' first few submissions are price-capped regardless of computed score, to limit the blast radius while an operator builds confidence in the account.
137
+
138
+ ## Things to keep in mind
139
+
140
+ - **Nothing uploads while your machine is off or asleep with no active session.** Auto-capture only runs at `SessionEnd` (live hook) or on the scheduled timer (requires macOS itself running). There's no queued/replay-on-wake behavior for missed intervals.
141
+ - **A "rejected" privacy verdict only grows, never shrinks.** Once a path is recorded as rejected-for-privacy or a duplicate, the CLI stops re-scanning and re-reporting that exact path on later syncs.
142
+ - **The scanner can false-positive on its own source code.** If a session's transcript includes reading the analyzer's own source, the scanner can flag its pattern literals themselves as a match. Always worth a quick manual look at `rejection_codes`/`secret_findings` before assuming a block means a real leaked credential.
143
+ - **Subagents are scored completely independently of their parent.** A rejected/quarantined parent session's subagent transcripts can still be scanned clean, uploaded, priced, and accepted on their own.
144
+ - **Exclusions and sharing mode are local-only settings** — they don't retroactively affect anything already submitted.
@@ -0,0 +1,125 @@
1
+ # Reasonwork — CLI + Claude Code plugin
2
+
3
+ Turn your Claude Code, Codex, or Cursor CLI sessions into reviewed, priced, paid contributions to Reasonwork — automatically, with privacy checks running locally before anything ever leaves your machine.
4
+
5
+ Your dashboard, settings, and token creation all live on the Reasonwork web app — sign in there to get started and to check your own submissions.
6
+
7
+ ## Requirements
8
+
9
+ - macOS (background auto-sync via `launchd` is macOS-only today; on Linux you can still use the CLI manually or wire your own systemd timer/cron entry).
10
+ - Python 3.12+.
11
+ - [`uv`](https://docs.astral.sh/uv/) for installing the CLI as a tool.
12
+ - Claude Code, if you want the plugin (hooks + slash commands) instead of running the CLI by hand.
13
+ - Codex, if you want the Codex hook + skill instead — unlike Claude Code, this install path is not yet verified end-to-end against a live Codex install.
14
+ - Cursor (the `cursor-agent` CLI, not the IDE chat panel), if you want the Cursor hook + skill instead — also not yet verified end-to-end against a live Cursor install, and depends on your installed Cursor version supporting the `sessionStart`/`sessionEnd` hook events.
15
+ - A Reasonwork account and an `nxc_…` contributor token, created from your account's settings page.
16
+
17
+ ## 1. Install the CLI
18
+
19
+ ```bash
20
+ pip install reasonwork
21
+ reasonwork --help
22
+ ```
23
+
24
+ ### Updating
25
+
26
+ ```bash
27
+ reasonwork update
28
+ ```
29
+
30
+ Detects how you installed it (pip/pipx/uv tool, or an editable install from a git checkout) and upgrades accordingly.
31
+
32
+ ## 2. Log in
33
+
34
+ Create a contributor token from your account's settings page, then store it locally:
35
+
36
+ ```bash
37
+ reasonwork login --token nxc_xxxxxxxx
38
+ ```
39
+
40
+ The token is written to a local config file (mode `0600`, owner read/write only). Use `login --dry-run` to just verify a token works without writing it to disk.
41
+
42
+ ## 3. Install the Claude Code plugin (recommended)
43
+
44
+ The plugin is what makes this hands-off: it hooks into Claude Code's session lifecycle so you don't have to remember to run `sync` yourself. It isn't published to a public marketplace — ask your Reasonwork contact for the marketplace source to add.
45
+
46
+ Once installed, it wires up:
47
+
48
+ | Hook | Fires on | What it does |
49
+ |---|---|---|
50
+ | `SessionEnd` | Every Claude Code session (and subagent) ending | Refreshes the local session index (`scan`). If `sharing_mode=all`, also runs `sync --yes` in the background to submit anything new. Never blocks session exit, never errors if the CLI isn't installed. |
51
+ | `SessionStart` | Every new session | If `sharing_mode=ask`, checks for pending unsynced sessions and nudges you. Uploads nothing on its own. |
52
+
53
+ And two slash commands: `/exchange-status` (read-only summary of your sharing settings and pending sessions) and `/exchange-sync` (shows exactly what would be submitted, asks for confirmation, then submits only if you confirm).
54
+
55
+ ## 4. Codex and Cursor (optional)
56
+
57
+ Both integrations work the same way: a local install script wires up a session-end/session-start hook and a skill, scoped entirely to that tool's own config directory — never touching anything Claude-Code-related. Neither is yet verified end-to-end against a live install; treat as best-effort. See your Reasonwork contact for the install scripts if you use Codex or Cursor CLI.
58
+
59
+ ## Turning on auto-capture (`sharing_mode`)
60
+
61
+ | Mode | Behavior |
62
+ |---|---|
63
+ | `none` | Nothing is scanned or submitted automatically. Manual `upload`/`sync` still works if you run it yourself. |
64
+ | `ask` *(default)* | Sessions are indexed locally, but nothing uploads without you confirming. |
65
+ | `all` | Full auto-capture: every session, at `SessionEnd`, is scanned and synced automatically — no prompt. |
66
+
67
+ ```bash
68
+ reasonwork config set --sharing-mode all
69
+ reasonwork config exclude --source codex # exclude a source or --path, add --remove to undo
70
+ reasonwork config show # check current settings
71
+ ```
72
+
73
+ ### Optional: scheduled background sync outside of Claude Code (macOS only)
74
+
75
+ ```bash
76
+ reasonwork schedule install --interval-minutes 30
77
+ reasonwork schedule status
78
+ reasonwork schedule uninstall
79
+ ```
80
+
81
+ ## CLI commands
82
+
83
+ | Command | Purpose |
84
+ |---|---|
85
+ | `reasonwork login --token nxc_…` | Verify and store your contributor token. |
86
+ | `reasonwork scan` | Discover local Claude Code/Codex/Cursor sessions and show metadata-only checks. Never uploads. |
87
+ | `reasonwork sync` | Submit every newly discovered, consented session not already recorded in the local ledger. |
88
+ | `reasonwork upload --path … --source … --confirm-rights` | Manually run the safety checks and upload a single specific file. |
89
+ | `reasonwork config show / set / exclude` | Inspect and adjust local sharing consent. |
90
+ | `reasonwork schedule install / status / uninstall` | Manage the optional macOS background timer. |
91
+ | `reasonwork update` | Upgrade to the latest version, however you installed it. |
92
+
93
+ Useful flags across most commands: `--dry-run` (preview only), `--json` (stable JSON output for scripting), `--yes` (skip the confirmation prompt on `sync`/`schedule install`).
94
+
95
+ ## Features
96
+
97
+ - **Local-first privacy scanning.** Every session is analyzed on your machine before anything uploads: secret detection (private keys, basic-auth URLs, API keys, etc.), email/phone PII counts, and an overall `privacy_risk` rating. A `blocked`/`high`/`medium` risk session is **rejected locally and never uploaded** — only a metadata-only rejection report is sent to the server for operator visibility, never the file content.
98
+ - **Exact-hash dedup and duplicate-content detection.** A session already submitted once is never re-submitted, even across renamed/moved files or when a *different* file's content turns out to be a byte-exact prefix of something already known (e.g. a session resumed, copied, or exported to a new location).
99
+ - **Subagent session recording**, across all three sources, each judged, priced, and paid independently of its parent session.
100
+ - **Server-side quality scoring and automatic pricing** based on privacy risk and content quality — the scoring/pricing logic itself is deliberately not part of this package, so it can't be reverse-engineered from a local install and gamed.
101
+ - **Full contributor data controls** — export your records, delete unaccepted raw submissions, and file tracked privacy requests (access, correction, deletion, restriction, opt-out) from your dashboard.
102
+
103
+ ## How it works end-to-end
104
+
105
+ 1. **Discover** — `scan`/`sync` find Claude Code, Codex, and Cursor session files (`.jsonl`) locally, including subagent transcripts.
106
+ 2. **Analyze locally** — for each new/changed file: parse JSONL, count messages/tool calls/tool results, run secret + PII detection, and decide a privacy risk level. Quality scoring itself happens server-side only.
107
+ 3. **Local gate** — if privacy risk is `medium`/`high`/`blocked`, or the file's content is a duplicate/contained-duplicate of something already known, it's rejected/skipped *before upload*, with only metadata reported to the server.
108
+ 4. **Upload** — anything that passes the local gate is uploaded.
109
+ 5. **Worker intake** — a backend worker re-runs the same deterministic analysis server-side, optionally adds an LLM ("semantic") quality judgment, and finalizes the record's status and price.
110
+ 6. **Review** — an operator reviews priced/quarantined items and accepts or rejects.
111
+ 7. **Payout** — accepted items get queued and paid out.
112
+
113
+ ## How scoring and pricing actually work
114
+
115
+ Quality scoring and pricing are computed **server-side only**, from a fresh re-download of what you actually uploaded — never trusted from anything this CLI reports about itself. That's deliberate: the exact formula (score weights, anti-gaming thresholds, price bands) lives only in the private backend, specifically so it can't be reverse-engineered and gamed by anyone who's installed this package.
116
+
117
+ At a high level, without exact numbers: a session earns credit for genuine tool diversity, real code edits (not just reads), substantive messages, and recovering from tool errors; sessions that look padded or that loop the same trivial tool call with no real edits score worse. An optional LLM pass can add a small bonus on top for sessions that clear every check, but it can never rescue a below-floor score or exceed the overall offer cap. New contributors' first few submissions are price-capped regardless of computed score, to limit the blast radius while an operator builds confidence in the account.
118
+
119
+ ## Things to keep in mind
120
+
121
+ - **Nothing uploads while your machine is off or asleep with no active session.** Auto-capture only runs at `SessionEnd` (live hook) or on the scheduled timer (requires macOS itself running). There's no queued/replay-on-wake behavior for missed intervals.
122
+ - **A "rejected" privacy verdict only grows, never shrinks.** Once a path is recorded as rejected-for-privacy or a duplicate, the CLI stops re-scanning and re-reporting that exact path on later syncs.
123
+ - **The scanner can false-positive on its own source code.** If a session's transcript includes reading the analyzer's own source, the scanner can flag its pattern literals themselves as a match. Always worth a quick manual look at `rejection_codes`/`secret_findings` before assuming a block means a real leaked credential.
124
+ - **Subagents are scored completely independently of their parent.** A rejected/quarantined parent session's subagent transcripts can still be scanned clean, uploaded, priced, and accepted on their own.
125
+ - **Exclusions and sharing mode are local-only settings** — they don't retroactively affect anything already submitted.
@@ -0,0 +1,67 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "reasonwork"
7
+ dynamic = ["version"]
8
+ description = "Reasonwork CLI: safely contribute Codex, Claude Code, and Cursor trajectories to Reasonwork."
9
+ readme = "PYPI_README.md"
10
+ requires-python = ">=3.12"
11
+ license = "LicenseRef-Proprietary"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "ReasonworkAI, Inc." }]
14
+ classifiers = [
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python :: 3",
17
+ ]
18
+ dependencies = [
19
+ "rich>=13.0",
20
+ "typer>=0.12",
21
+ ]
22
+
23
+ [project.optional-dependencies]
24
+ worker = [
25
+ "boto3>=1.35",
26
+ "litellm>=1.50",
27
+ "supabase>=2.0,<3",
28
+ ]
29
+
30
+ [project.scripts]
31
+ reasonwork = "reasonwork_exchange.cli:entrypoint"
32
+
33
+ [dependency-groups]
34
+ dev = [
35
+ "pytest>=8",
36
+ "ruff==0.15.22",
37
+ "ty==0.0.60",
38
+ ]
39
+
40
+ [tool.pytest.ini_options]
41
+ testpaths = ["tests"]
42
+
43
+ [tool.setuptools.dynamic]
44
+ version = { attr = "reasonwork_exchange.__version__" }
45
+
46
+ [tool.setuptools.packages.find]
47
+ where = ["src"]
48
+
49
+ [tool.ruff]
50
+ line-length = 120
51
+ target-version = "py312"
52
+
53
+ [tool.ruff.format]
54
+ skip-magic-trailing-comma = true
55
+
56
+ [tool.ruff.lint]
57
+ select = ["E", "F", "I", "W", "UP", "B", "D", "ANN"]
58
+ ignore = ["E501", "B008"]
59
+
60
+ [tool.ruff.lint.per-file-ignores]
61
+ "tests/**" = ["D", "ANN"]
62
+
63
+ [tool.ruff.lint.pydocstyle]
64
+ convention = "google"
65
+
66
+ [tool.ruff.lint.isort]
67
+ split-on-trailing-comma = false
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: reasonwork
3
+ Version: 0.4.0
4
+ Summary: Reasonwork CLI: safely contribute Codex, Claude Code, and Cursor trajectories to Reasonwork.
5
+ Author: ReasonworkAI, Inc.
6
+ License-Expression: LicenseRef-Proprietary
7
+ Classifier: Operating System :: OS Independent
8
+ Classifier: Programming Language :: Python :: 3
9
+ Requires-Python: >=3.12
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: rich>=13.0
13
+ Requires-Dist: typer>=0.12
14
+ Provides-Extra: worker
15
+ Requires-Dist: boto3>=1.35; extra == "worker"
16
+ Requires-Dist: litellm>=1.50; extra == "worker"
17
+ Requires-Dist: supabase<3,>=2.0; extra == "worker"
18
+ Dynamic: license-file
19
+
20
+ # Reasonwork — CLI + Claude Code plugin
21
+
22
+ Turn your Claude Code, Codex, or Cursor CLI sessions into reviewed, priced, paid contributions to Reasonwork — automatically, with privacy checks running locally before anything ever leaves your machine.
23
+
24
+ Your dashboard, settings, and token creation all live on the Reasonwork web app — sign in there to get started and to check your own submissions.
25
+
26
+ ## Requirements
27
+
28
+ - macOS (background auto-sync via `launchd` is macOS-only today; on Linux you can still use the CLI manually or wire your own systemd timer/cron entry).
29
+ - Python 3.12+.
30
+ - [`uv`](https://docs.astral.sh/uv/) for installing the CLI as a tool.
31
+ - Claude Code, if you want the plugin (hooks + slash commands) instead of running the CLI by hand.
32
+ - Codex, if you want the Codex hook + skill instead — unlike Claude Code, this install path is not yet verified end-to-end against a live Codex install.
33
+ - Cursor (the `cursor-agent` CLI, not the IDE chat panel), if you want the Cursor hook + skill instead — also not yet verified end-to-end against a live Cursor install, and depends on your installed Cursor version supporting the `sessionStart`/`sessionEnd` hook events.
34
+ - A Reasonwork account and an `nxc_…` contributor token, created from your account's settings page.
35
+
36
+ ## 1. Install the CLI
37
+
38
+ ```bash
39
+ pip install reasonwork
40
+ reasonwork --help
41
+ ```
42
+
43
+ ### Updating
44
+
45
+ ```bash
46
+ reasonwork update
47
+ ```
48
+
49
+ Detects how you installed it (pip/pipx/uv tool, or an editable install from a git checkout) and upgrades accordingly.
50
+
51
+ ## 2. Log in
52
+
53
+ Create a contributor token from your account's settings page, then store it locally:
54
+
55
+ ```bash
56
+ reasonwork login --token nxc_xxxxxxxx
57
+ ```
58
+
59
+ The token is written to a local config file (mode `0600`, owner read/write only). Use `login --dry-run` to just verify a token works without writing it to disk.
60
+
61
+ ## 3. Install the Claude Code plugin (recommended)
62
+
63
+ The plugin is what makes this hands-off: it hooks into Claude Code's session lifecycle so you don't have to remember to run `sync` yourself. It isn't published to a public marketplace — ask your Reasonwork contact for the marketplace source to add.
64
+
65
+ Once installed, it wires up:
66
+
67
+ | Hook | Fires on | What it does |
68
+ |---|---|---|
69
+ | `SessionEnd` | Every Claude Code session (and subagent) ending | Refreshes the local session index (`scan`). If `sharing_mode=all`, also runs `sync --yes` in the background to submit anything new. Never blocks session exit, never errors if the CLI isn't installed. |
70
+ | `SessionStart` | Every new session | If `sharing_mode=ask`, checks for pending unsynced sessions and nudges you. Uploads nothing on its own. |
71
+
72
+ And two slash commands: `/exchange-status` (read-only summary of your sharing settings and pending sessions) and `/exchange-sync` (shows exactly what would be submitted, asks for confirmation, then submits only if you confirm).
73
+
74
+ ## 4. Codex and Cursor (optional)
75
+
76
+ Both integrations work the same way: a local install script wires up a session-end/session-start hook and a skill, scoped entirely to that tool's own config directory — never touching anything Claude-Code-related. Neither is yet verified end-to-end against a live install; treat as best-effort. See your Reasonwork contact for the install scripts if you use Codex or Cursor CLI.
77
+
78
+ ## Turning on auto-capture (`sharing_mode`)
79
+
80
+ | Mode | Behavior |
81
+ |---|---|
82
+ | `none` | Nothing is scanned or submitted automatically. Manual `upload`/`sync` still works if you run it yourself. |
83
+ | `ask` *(default)* | Sessions are indexed locally, but nothing uploads without you confirming. |
84
+ | `all` | Full auto-capture: every session, at `SessionEnd`, is scanned and synced automatically — no prompt. |
85
+
86
+ ```bash
87
+ reasonwork config set --sharing-mode all
88
+ reasonwork config exclude --source codex # exclude a source or --path, add --remove to undo
89
+ reasonwork config show # check current settings
90
+ ```
91
+
92
+ ### Optional: scheduled background sync outside of Claude Code (macOS only)
93
+
94
+ ```bash
95
+ reasonwork schedule install --interval-minutes 30
96
+ reasonwork schedule status
97
+ reasonwork schedule uninstall
98
+ ```
99
+
100
+ ## CLI commands
101
+
102
+ | Command | Purpose |
103
+ |---|---|
104
+ | `reasonwork login --token nxc_…` | Verify and store your contributor token. |
105
+ | `reasonwork scan` | Discover local Claude Code/Codex/Cursor sessions and show metadata-only checks. Never uploads. |
106
+ | `reasonwork sync` | Submit every newly discovered, consented session not already recorded in the local ledger. |
107
+ | `reasonwork upload --path … --source … --confirm-rights` | Manually run the safety checks and upload a single specific file. |
108
+ | `reasonwork config show / set / exclude` | Inspect and adjust local sharing consent. |
109
+ | `reasonwork schedule install / status / uninstall` | Manage the optional macOS background timer. |
110
+ | `reasonwork update` | Upgrade to the latest version, however you installed it. |
111
+
112
+ Useful flags across most commands: `--dry-run` (preview only), `--json` (stable JSON output for scripting), `--yes` (skip the confirmation prompt on `sync`/`schedule install`).
113
+
114
+ ## Features
115
+
116
+ - **Local-first privacy scanning.** Every session is analyzed on your machine before anything uploads: secret detection (private keys, basic-auth URLs, API keys, etc.), email/phone PII counts, and an overall `privacy_risk` rating. A `blocked`/`high`/`medium` risk session is **rejected locally and never uploaded** — only a metadata-only rejection report is sent to the server for operator visibility, never the file content.
117
+ - **Exact-hash dedup and duplicate-content detection.** A session already submitted once is never re-submitted, even across renamed/moved files or when a *different* file's content turns out to be a byte-exact prefix of something already known (e.g. a session resumed, copied, or exported to a new location).
118
+ - **Subagent session recording**, across all three sources, each judged, priced, and paid independently of its parent session.
119
+ - **Server-side quality scoring and automatic pricing** based on privacy risk and content quality — the scoring/pricing logic itself is deliberately not part of this package, so it can't be reverse-engineered from a local install and gamed.
120
+ - **Full contributor data controls** — export your records, delete unaccepted raw submissions, and file tracked privacy requests (access, correction, deletion, restriction, opt-out) from your dashboard.
121
+
122
+ ## How it works end-to-end
123
+
124
+ 1. **Discover** — `scan`/`sync` find Claude Code, Codex, and Cursor session files (`.jsonl`) locally, including subagent transcripts.
125
+ 2. **Analyze locally** — for each new/changed file: parse JSONL, count messages/tool calls/tool results, run secret + PII detection, and decide a privacy risk level. Quality scoring itself happens server-side only.
126
+ 3. **Local gate** — if privacy risk is `medium`/`high`/`blocked`, or the file's content is a duplicate/contained-duplicate of something already known, it's rejected/skipped *before upload*, with only metadata reported to the server.
127
+ 4. **Upload** — anything that passes the local gate is uploaded.
128
+ 5. **Worker intake** — a backend worker re-runs the same deterministic analysis server-side, optionally adds an LLM ("semantic") quality judgment, and finalizes the record's status and price.
129
+ 6. **Review** — an operator reviews priced/quarantined items and accepts or rejects.
130
+ 7. **Payout** — accepted items get queued and paid out.
131
+
132
+ ## How scoring and pricing actually work
133
+
134
+ Quality scoring and pricing are computed **server-side only**, from a fresh re-download of what you actually uploaded — never trusted from anything this CLI reports about itself. That's deliberate: the exact formula (score weights, anti-gaming thresholds, price bands) lives only in the private backend, specifically so it can't be reverse-engineered and gamed by anyone who's installed this package.
135
+
136
+ At a high level, without exact numbers: a session earns credit for genuine tool diversity, real code edits (not just reads), substantive messages, and recovering from tool errors; sessions that look padded or that loop the same trivial tool call with no real edits score worse. An optional LLM pass can add a small bonus on top for sessions that clear every check, but it can never rescue a below-floor score or exceed the overall offer cap. New contributors' first few submissions are price-capped regardless of computed score, to limit the blast radius while an operator builds confidence in the account.
137
+
138
+ ## Things to keep in mind
139
+
140
+ - **Nothing uploads while your machine is off or asleep with no active session.** Auto-capture only runs at `SessionEnd` (live hook) or on the scheduled timer (requires macOS itself running). There's no queued/replay-on-wake behavior for missed intervals.
141
+ - **A "rejected" privacy verdict only grows, never shrinks.** Once a path is recorded as rejected-for-privacy or a duplicate, the CLI stops re-scanning and re-reporting that exact path on later syncs.
142
+ - **The scanner can false-positive on its own source code.** If a session's transcript includes reading the analyzer's own source, the scanner can flag its pattern literals themselves as a match. Always worth a quick manual look at `rejection_codes`/`secret_findings` before assuming a block means a real leaked credential.
143
+ - **Subagents are scored completely independently of their parent.** A rejected/quarantined parent session's subagent transcripts can still be scanned clean, uploaded, priced, and accepted on their own.
144
+ - **Exclusions and sharing mode are local-only settings** — they don't retroactively affect anything already submitted.
@@ -0,0 +1,29 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ PYPI_README.md
4
+ pyproject.toml
5
+ src/reasonwork.egg-info/PKG-INFO
6
+ src/reasonwork.egg-info/SOURCES.txt
7
+ src/reasonwork.egg-info/dependency_links.txt
8
+ src/reasonwork.egg-info/entry_points.txt
9
+ src/reasonwork.egg-info/requires.txt
10
+ src/reasonwork.egg-info/top_level.txt
11
+ src/reasonwork_exchange/__init__.py
12
+ src/reasonwork_exchange/__main__.py
13
+ src/reasonwork_exchange/analyzer.py
14
+ src/reasonwork_exchange/auth.py
15
+ src/reasonwork_exchange/client.py
16
+ src/reasonwork_exchange/config.py
17
+ src/reasonwork_exchange/discovery.py
18
+ src/reasonwork_exchange/errors.py
19
+ src/reasonwork_exchange/output.py
20
+ src/reasonwork_exchange/state.py
21
+ src/reasonwork_exchange/version_check.py
22
+ src/reasonwork_exchange/cli/__init__.py
23
+ src/reasonwork_exchange/cli/config.py
24
+ src/reasonwork_exchange/cli/login.py
25
+ src/reasonwork_exchange/cli/scan.py
26
+ src/reasonwork_exchange/cli/schedule.py
27
+ src/reasonwork_exchange/cli/sync.py
28
+ src/reasonwork_exchange/cli/update.py
29
+ src/reasonwork_exchange/cli/upload.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ reasonwork = reasonwork_exchange.cli:entrypoint
@@ -0,0 +1,7 @@
1
+ rich>=13.0
2
+ typer>=0.12
3
+
4
+ [worker]
5
+ boto3>=1.35
6
+ litellm>=1.50
7
+ supabase<3,>=2.0
@@ -0,0 +1 @@
1
+ reasonwork_exchange
@@ -0,0 +1,3 @@
1
+ """Public package for the standalone Reasonwork CLI (by ReasonworkAI)."""
2
+
3
+ __version__ = "0.4.0"
@@ -0,0 +1,6 @@
1
+ """Run the standalone CLI with `python -m reasonwork_exchange`."""
2
+
3
+ from reasonwork_exchange.cli import entrypoint
4
+
5
+ if __name__ == "__main__":
6
+ entrypoint()