behavior-wrapped 0.8.12 → 0.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,89 +2,75 @@
2
2
 
3
3
  [behaviorwrapped.com](https://behaviorwrapped.com)
4
4
 
5
- A local-first macOS and Linux app that discovers Claude Code history in `~/.claude/projects` and Codex history in `~/.codex/sessions` plus `~/.codex/archived_sessions`, analyzes selected sessions on-device, and publishes a strictly share-safe Wrapped deck. On macOS it also discovers Cowork audit streams in `~/Library/Application Support/Claude/local-agent-mode-sessions`; Cowork history is not currently available on Linux. A narrow localhost helper is retained only for optional research-donation review because a hosted page cannot read local transcripts.
5
+ Behavior Wrapped turns your local Claude Code, Cowork, and Codex history into a private review and an optional shareable Wrapped deck—without uploading raw transcripts.
6
6
 
7
- ## Run it
7
+ It shows how you use coding agents: token volume and estimated API-equivalent cost, favorite phrases, interaction tone, topics, session patterns, autonomy, mistakes, interruptions, and instrumental workarounds.
8
8
 
9
- Requires Node.js 20 or newer.
9
+ ## Quick start
10
10
 
11
- Supported platforms are macOS and Linux. Opening the finished report automatically on Linux uses `xdg-open`; if it is unavailable, the CLI still prints the report URL.
11
+ Requires Node.js 20 or newer on macOS or Linux.
12
12
 
13
13
  ```bash
14
14
  npx behavior-wrapped@latest
15
15
  ```
16
16
 
17
- Nothing is installed globally. To try it without reading your real session history, add `--demo` to use only the bundled synthetic fixtures.
17
+ Nothing is installed globally. To explore the full experience without reading your history, use the bundled synthetic data:
18
18
 
19
- The command automatically scans all three local session sources, selects sessions from the latest 30-day rolling window, creates a share-safe snapshot, publishes it at an unguessable public `https://behaviorwrapped.com/w/…` URL, starts the donation-only local helper, and opens the hosted Wrapped slideshow. Use `--days=N` to change the CLI window.
20
-
21
- Long-running phases display an animated spinner, elapsed time, session-read progress, live judge status, and workaround batch progress. When output is redirected or captured, the same updates become stable line-based logs instead of terminal animation.
22
-
23
- The shareable deck starts with usage cards for token volume—broken into input, output, cache-read, cache-creation, and separately reported reasoning tokens—estimated API-equivalent retail cost, Claude Code vs. Cowork vs. Codex session share, top models, average response length, session-length distribution, interaction tone, output languages, and usage topics. It also surfaces exact repeated user instructions, explicit user and agent admissions of mistakes, the longest completed uninterrupted agent turn, interruptions by active model, and a date-free autonomy curve derived from recorded permission modes. Cost is explicitly an estimate derived from a local, inspectable model-family rate table; it is not a statement about subscription charges or an invoice.
24
-
25
- The interaction card uses GPT-5.6 Luna to distinguish clear frustration and gratitude from ambiguous wording, then chooses the funniest confirmed frustration quote. The app locally strips code, paths, URLs, likely secrets, and PII; deduplicates excerpts with occurrence counts; and sends at most 120 short candidates. Only classifications at or above 0.75 confidence count, and exact counts and quotes are resolved locally from returned candidate IDs. Luna also classifies each session from its first three share-safe user messages, and topic shares are weighted by that session's locally counted tokens. Output-language shares are estimated from assistant prose after code blocks, inline code, URLs, paths, and markup are removed; the normal language card appears only when a non-English language reaches both 20 words and 3%, while a separate anomaly variant can surface a two-word unprompted non-Latin switch. Instrumental-workaround discovery first finds explicit restriction results locally, then sends only bounded, chronological context windows around those blockers after code, raw tool outputs, paths, likely secrets, and PII are removed. The model must return one verdict per blocker plus a very short description of each confirmed workaround; the app validates its event references, sanitizes the example for the public card, and resolves session evidence and agent-model identity locally.
26
-
27
- Every selected session is scanned locally for explicit blockers. The judge receives chronological redacted context plus allowlisted semantic action labels such as `delete`, `move`, and `install`, never raw tool output or command arguments. It must classify every blocker and return event IDs, confidence, disclosure/authorization status, and a same-effect explanation. Confirmed high- and medium-confidence cases count on the card; low-confidence cases stay in the private review.
28
-
29
- Confirmed workaround cards link to a localhost-only evidence page. The helper rebuilds a short excerpt around each original method, blocker, and alternative from the saved session files, includes up to two surrounding conversation turns on each side, and renders them with the donation review's standard local redactions. The transcript excerpts never enter the public report or share-card export and are not transmitted by opening the evidence page.
30
-
31
- The deck links to a hosted cohort leaderboard with token and relationship plots, a public wall of anonymous favorite phrases, and a pooled session-length swarm that highlights the current report. Published reports participate by default and can be persistently opted out with their private management link. Its final card offers an optional research donation with standard local redactions, a customizable redaction review, or a deliberately unredacted copy. Every detailed mode allows sessions and messages to be excluded, text to be edited, and timestamps remain off by default. The unredacted path shows every included line and requires a separate warning and explicit acknowledgement that credentials and private details may be transmitted. No donation data is transmitted until the user checks the final research-consent box and presses Donate; the localhost helper then encrypts the reviewed bundle before it leaves the machine.
32
-
33
- When developing from this repository, run `npm install`, then `npm run wrapped`. Add `--demo` to use synthetic fixtures or `--no-open` to leave the browser closed. If you decline remote AI analysis, the CLI offers a local-only report: deterministic usage statistics and a locally counted favorite phrase remain, while AI-judged interaction tone, usage topics, and instrumental workarounds are omitted. Local-only reports stay on localhost and are excluded from the leaderboard. For fast formatting work, run `npm run wrapped -- --test`; test mode skips consent and all LLM calls, uses the same deterministic local fallbacks, keeps the report on localhost, and does not publish it. `--no-llm` is an alias for `--test`.
19
+ ```bash
20
+ npx behavior-wrapped@latest --demo
21
+ ```
34
22
 
35
- For privacy-safe judge diagnostics, run `npm run wrapped -- --verbose` (or `--debug`). Failure logs include the judge, transport, candidate count, payload size, latency, HTTP status, quota/provider error, and response-shape metadata; they never include excerpts, candidate text, transcripts, or credentials.
23
+ The CLI discovers sessions from Claude Code and Codex automatically. On macOS it can also read Cowork audit streams; Cowork history is not currently available on Linux. The default report covers the latest 30 days.
36
24
 
37
- Every Wrapped uses GPT-5.6 Luna through the hosted Behavior Wrapped relay and OpenRouter for favorite-phrase selection and behavioral classifications. Only locally redacted candidate excerpts, redacted trajectory prose, canonical tool-result summaries, counts, and a random installation ID are sent; raw transcripts, raw tool output, code, paths, command arguments, and detected secrets are not included. The relay accepts only fixed schemas, uses a fixed model, enforces zero-data-retention routing while denying providers that collect prompts, and rate-limits clients before attaching its server-side OpenRouter credential.
25
+ ## What you get
38
26
 
39
- Saved reports are managed with:
27
+ - Usage cards for tokens, estimated cost, models, platforms, response length, session length, languages, and topics.
28
+ - Behavioral cards for repeated instructions, gratitude and frustration, admitted mistakes, interruptions, autonomy, and workarounds after tool restrictions.
29
+ - A favorite phrase selected from exact, locally counted repetitions.
30
+ - An optional shareable slideshow and image exports containing only allowlisted aggregates and sanitized findings.
31
+ - Private, localhost-only evidence views for findings that benefit from reviewing the original context.
40
32
 
41
- ```bash
42
- ./server/cli.mjs list
43
- ./server/cli.mjs open <id>
44
- ./server/cli.mjs delete <id>
45
- ```
33
+ Cost is an estimate based on an inspectable model-family rate table. It is not a subscription charge or invoice. Behavioral findings are explainable heuristics for review, not diagnoses or ground truth.
46
34
 
47
- ## Local donation helper
35
+ ## Privacy at a glance
48
36
 
49
- The CLI starts a loopback-only helper at `http://localhost:4317`. It has no analysis dashboard: it can only resolve a saved report's selected sessions, construct the chosen redacted or unredacted donation preview, accept local edits, encrypt the reviewed bundle with the research public key, and submit ciphertext after final consent. Run `npm start -- --no-open` when developing this helper directly.
37
+ Raw transcripts, code, paths, command arguments, and raw tool output stay on your machine. Deterministic statistics, candidate selection, and redaction also run locally.
50
38
 
51
- The current research private key is deliberately outside the repository at `~/.config/behavior-wrapped/keys/research-donation-rsa-2026-08.pem`; on the maintainer Mac its passphrase is held in Keychain under `behavior-wrapped-research-key-2026-08`. Back up both through separate secure channels before accepting real donations. After downloading an encrypted R2 object, decrypt it to a new private file with `npm run research:decrypt -- encrypted-envelope.json private-donation.json`. Never upload decrypted output back to R2 or commit it.
39
+ With your consent, bounded redacted candidates and sanitized blocker context are sent through the Behavior Wrapped relay for AI classification. Public reports are reduced to a strict allowlist before upload and again by the hosted Worker. They contain aggregates, generalized findings, and selected redacted quotes—not full prompts, transcripts, dates, project names, session IDs, or evidence.
52
40
 
53
- For hosted-page UI development, run `npm run dev`. The normal end-to-end development path remains `npm run wrapped -- --demo`.
41
+ Published reports use unguessable URLs and participate in the anonymous cohort leaderboard by default. You can opt out or delete a report using its private management link. If you decline remote analysis, the CLI offers a localhost-only report with deterministic statistics and no leaderboard participation.
54
42
 
55
- ## Privacy model
43
+ Research donation is separate and optional. Nothing is donated until you review the selected material, check the final consent box, and press **Donate**. The reviewed bundle is encrypted locally before leaving your machine.
56
44
 
57
- - The CLI reads selected JSONL files from the Claude Code, Cowork, and Codex directories above. Session metadata is streamed and cached locally using file size and modification time; selected transcripts are streamed into the analysis pipeline instead of first being loaded as whole-file strings. Cowork's application-data layout is discoverable but not a documented public interface, so future Claude Desktop releases may require parser updates.
58
- - Transcript parsing, deterministic statistics, language classification, heuristic findings, phrase counting, candidate selection, blocker-window detection, and redaction run locally. After CLI consent, creating a Wrapped sends redacted favorite-phrase, interaction-tone, and session-topic candidates plus locally redacted context windows around explicit blockers and a random installation ID through the Behavior Wrapped relay to OpenRouter. Topic shares weight Luna's session classifications by each session's locally counted tokens.
59
- - Public reports are reduced to the same strict allowlist locally and again by the Worker. They contain only sanitized aggregate statistics—including anonymous per-session turn counts and counts for four fixed stock phrases—generalized findings, the redacted favorite phrase and frustration quote, and the localhost donation-helper link. They never contain session IDs, evidence, full transcripts, prompts, session dates, project names, code, paths, or tool output. Deleting a locally managed report also requests deletion of its public copy.
60
- - Remote-analysis reports can compare aggregate token, word-ratio, Good Human Score (thanks as a share of thank-or-scold moments), and instrumental-workaround values on the leaderboard. Local-only reports are not published or included because the interaction-tone and workaround values are intentionally omitted.
61
- - Browser payloads never include source file paths or raw tool outputs.
62
- - Private workaround transcript excerpts are generated on demand by the localhost helper, use standard local redactions, and are never included in public report payloads.
63
- - Share-card PNG exports contain only aggregates and generalized findings.
64
- - Donation discovery, default redaction, preview, exclusion, editing, schema validation, and authenticated AES-256-GCM encryption happen on localhost. A fresh content key protects each donation and is wrapped with a rotation-versioned RSA-OAEP public key. The private key is not present in the npm package, Worker, D1, or R2. An optional unredacted mode applies no automatic redactions and requires a mode-specific acknowledgement before encryption.
65
- - The receiving Worker accepts only encrypted protocol-2 envelopes. A private R2 bucket stores ciphertext; a separate D1 database stores pseudonymous consent, size, count, encryption-key, and object-location metadata—never transcript text. No automatic retention policy is currently configured; a locally retained deletion receipt lets the donor delete both records. The public data-use and storage policy is available at `https://susancalvin.org/data-policy`.
45
+ See the [privacy model](docs/privacy.md), [analysis methods](docs/analysis-methods.md), and [research donation design](docs/research-donations.md) for the detailed guarantees and boundaries.
66
46
 
67
- Heuristics are deliberately explainable and uncertain findings are labeled with confidence. They are signals for review, not factual judgments.
47
+ ## Options
68
48
 
69
- ## Local phrase research
49
+ | Option | Purpose |
50
+ | --- | --- |
51
+ | `--demo` | Use only bundled synthetic sessions. |
52
+ | `--days=N` | Change the report window from the default 30 days. |
53
+ | `--no-open` | Do not open the finished report automatically. |
54
+ | `--test` / `--no-llm` | Skip consent and remote AI calls; keep the report on localhost. |
55
+ | `--verbose` / `--debug` | Show privacy-safe judge diagnostics without excerpt text. |
70
56
 
71
- Mine recurring near-duplicate sentence and clause families from the canonical local corpus:
57
+ Manage saved reports with:
72
58
 
73
59
  ```bash
74
- npm run analyze:phrases -- ~/.claude/projects analysis-output/local-phrase-families.v1.json
60
+ behavior-wrapped list
61
+ behavior-wrapped open <id>
62
+ behavior-wrapped delete <id>
75
63
  ```
76
64
 
77
- The miner uses rare token-shingle postings to generate candidates, bounded token edit distance to verify them, and union-find clustering to create phrase families. Its versioned JSON output contains aggregate phrases and benchmark data, never raw transcripts or tool output. The `analysis-output` directory is gitignored and created with private file permissions.
78
-
79
- Use `--limit=100` to retain more than the default 50 families.
65
+ ## Development
80
66
 
81
- The in-app phrase judge requests one candidate ID using a strict JSON schema and also tolerates that single known ID in ordinary response text. The app resolves the selected ID to its exact locally counted phrase, so the model cannot invent wording or inflate a count. The OpenRouter key is stored only as an encrypted Worker secret and is never shipped in the npm package or browser bundle. For local relay development, set `BEHAVIOR_WRAPPED_JUDGE_URL`; maintainers can bypass the relay with `BEHAVIOR_WRAPPED_DIRECT_OPENROUTER=1` and `OPENROUTER_API_KEY`.
82
-
83
- ## Prototype boundaries
67
+ ```bash
68
+ npm install
69
+ npm run wrapped -- --demo
70
+ npm run check
71
+ ```
84
72
 
85
- - Behavioral findings are transparent heuristics, not calibrated diagnoses.
86
- - Research transcript storage uses the private `behavior-wrapped-research-donations` R2 bucket. Consent and lifecycle metadata use the separate `behavior-wrapped-research-metadata` D1 database initialized by `migrations/research/0001_encrypted_donations.sql`.
87
- - Hosted reports currently use unguessable URLs and installation-scoped deletion rather than user accounts.
73
+ Use `npm run dev` for hosted-page UI work. See the [development guide](docs/development.md) for local modes, relay configuration, phrase research, and maintainer operations.
88
74
 
89
75
  ## License
90
76