coauthored 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/PRIVACY.md +107 -0
- package/README.md +113 -3
- package/THIRD_PARTY_LICENSES.md +105 -0
- package/dist/cli/analytics/anchors.js +39 -0
- package/dist/cli/analytics/archetypes.js +193 -0
- package/dist/cli/analytics/content/analyzer.js +945 -0
- package/dist/cli/analytics/content/classify.js +115 -0
- package/dist/cli/analytics/content/demo-corpus.js +301 -0
- package/dist/cli/analytics/content/sketch.js +54 -0
- package/dist/cli/analytics/dataset.js +321 -0
- package/dist/cli/analytics/demo-fixtures.js +531 -0
- package/dist/cli/analytics/fdr.js +183 -0
- package/dist/cli/analytics/helicorder.js +66 -0
- package/dist/cli/analytics/insights.js +589 -0
- package/dist/cli/analytics/models.js +75 -0
- package/dist/cli/analytics/pricing.js +121 -0
- package/dist/cli/analytics/probable-cause.js +115 -0
- package/dist/cli/analytics/report-builder.js +162 -0
- package/dist/cli/analytics/statistics.js +91 -0
- package/dist/cli/analytics/time.js +252 -0
- package/dist/cli/cli/args.js +105 -0
- package/dist/cli/cli/browser.js +71 -0
- package/dist/cli/cli/index.js +20 -0
- package/dist/cli/cli/main.js +520 -0
- package/dist/cli/cli/phrase-review.js +78 -0
- package/dist/cli/cli/server.js +481 -0
- package/dist/cli/cli/terminal.js +363 -0
- package/dist/cli/ingest/adapters/aider.js +116 -0
- package/dist/cli/ingest/adapters/claude-code.js +139 -0
- package/dist/cli/ingest/adapters/cline-roo.js +89 -0
- package/dist/cli/ingest/adapters/codex-cli.js +240 -0
- package/dist/cli/ingest/adapters/content.js +99 -0
- package/dist/cli/ingest/adapters/cursor-ide.js +149 -0
- package/dist/cli/ingest/adapters/gemini-cli.js +208 -0
- package/dist/cli/ingest/adapters/index.js +18 -0
- package/dist/cli/ingest/adapters/opencode.js +203 -0
- package/dist/cli/ingest/adapters/pi-agent.js +85 -0
- package/dist/cli/ingest/adapters/shared.js +484 -0
- package/dist/cli/ingest/content-sink.js +31 -0
- package/dist/cli/ingest/discovery.js +50 -0
- package/dist/cli/ingest/message-digests.js +61 -0
- package/dist/cli/ingest/pipeline.js +155 -0
- package/dist/cli/ingest/safe-fs.js +284 -0
- package/dist/cli/ingest/sqlite-stage.js +139 -0
- package/dist/cli/ingest/time-window.js +34 -0
- package/dist/cli/ingest/tool-map.js +24 -0
- package/dist/cli/ingest/types.js +1 -0
- package/dist/cli/ingest/worker.js +97 -0
- package/dist/cli/report/content/emoji-names.js +3956 -0
- package/dist/cli/report/content/insights.js +41 -0
- package/dist/cli/report/content/lexicons.js +112 -0
- package/dist/cli/report/content/policy.js +77 -0
- package/dist/cli/report/content/redact.js +164 -0
- package/dist/cli/report/content/stopwords.js +8848 -0
- package/dist/cli/report/content/suppression.js +2617 -0
- package/dist/cli/report/content/validate.js +152 -0
- package/dist/cli/report/copy-lint.js +105 -0
- package/dist/cli/report/share.js +132 -0
- package/dist/cli/report/types.js +1 -0
- package/dist/cli/report/validators.js +334 -0
- package/dist/web/assets/Archivo-VF-BohoA-Sn.woff2 +0 -0
- package/dist/web/assets/DelaGothicOne-subset-CpoJGhTq.woff2 +0 -0
- package/dist/web/assets/Film-BkhZFxG9.css +1 -0
- package/dist/web/assets/MartianMono-VF-CmJ1nXx9.woff2 +0 -0
- package/dist/web/assets/app-Dw1a5h5V.js +38 -0
- package/dist/web/assets/bricolage-grotesque-latin-700-normal-gtcctNPv.woff2 +0 -0
- package/dist/web/assets/bricolage-grotesque-latin-800-normal-J50vIsBe.woff2 +0 -0
- package/dist/web/assets/chorus-D7bfON5Z.ogg +0 -0
- package/dist/web/assets/chorus-bass-CBTKpMv_.ogg +0 -0
- package/dist/web/assets/chorus-drums-BOzgLSoq.ogg +0 -0
- package/dist/web/assets/chorus-harmony-DnJYs_tp.ogg +0 -0
- package/dist/web/assets/chorus-lead-CFpg5DC1.ogg +0 -0
- package/dist/web/assets/chunk-BNfsY4o8.js +1 -0
- package/dist/web/assets/chunk-BSm8IhPY.js +1 -0
- package/dist/web/assets/chunk-Bi6EQAkf.js +1 -0
- package/dist/web/assets/chunk-D6HyoJCB.js +46 -0
- package/dist/web/assets/chunk-DrEayQLY.js +1 -0
- package/dist/web/assets/chunk-V3YGpFIw.js +1 -0
- package/dist/web/assets/chunk-XGhNFWse.js +1 -0
- package/dist/web/assets/dialogue-card-A5zmbNhu.ogg +0 -0
- package/dist/web/assets/groove-bass-BFNelLKi.ogg +0 -0
- package/dist/web/assets/groove-drums-BY1SBntR.ogg +0 -0
- package/dist/web/assets/groove-harmony-C0CrBzu3.ogg +0 -0
- package/dist/web/assets/groove-lead-CEYPzm5U.ogg +0 -0
- package/dist/web/assets/groove-ln-zQmTb.ogg +0 -0
- package/dist/web/assets/guess-high-CL6mF18x.ogg +0 -0
- package/dist/web/assets/guess-low-C3UnKayZ.ogg +0 -0
- package/dist/web/assets/higher-BevsMIWl.ogg +0 -0
- package/dist/web/assets/identity-0EPS3msD.ogg +0 -0
- package/dist/web/assets/index-DpT0dtHc.css +1 -0
- package/dist/web/assets/intro-DeRh6kUx.ogg +0 -0
- package/dist/web/assets/intro-bass-D63IPU0H.ogg +0 -0
- package/dist/web/assets/intro-drums-Dt9QO534.ogg +0 -0
- package/dist/web/assets/intro-harmony-DBsMG9jJ.ogg +0 -0
- package/dist/web/assets/intro-lead-DWcWS1ia.ogg +0 -0
- package/dist/web/assets/jar-coin-rtCvspuq.ogg +0 -0
- package/dist/web/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/web/assets/ledger-tick-C1rQgQGX.ogg +0 -0
- package/dist/web/assets/night-B_bMOZcf.ogg +0 -0
- package/dist/web/assets/night-bass-B-7Ay9ME.ogg +0 -0
- package/dist/web/assets/night-drums-zEtqWXX3.ogg +0 -0
- package/dist/web/assets/night-harmony-C5Ix2yce.ogg +0 -0
- package/dist/web/assets/night-lead-B7KMlRyj.ogg +0 -0
- package/dist/web/assets/ourturn-DX78hTEz.ogg +0 -0
- package/dist/web/assets/plus-jakarta-sans-latin-400-normal-Dhut76fR.woff2 +0 -0
- package/dist/web/assets/plus-jakarta-sans-latin-500-normal-Bf-nb4oT.woff2 +0 -0
- package/dist/web/assets/plus-jakarta-sans-latin-600-normal-DLTa1BUW.woff2 +0 -0
- package/dist/web/assets/plus-jakarta-sans-latin-700-normal-CfpNZvy6.woff2 +0 -0
- package/dist/web/assets/reveal-BmWAGHih.ogg +0 -0
- package/dist/web/assets/review-split-Dac4zagw.ogg +0 -0
- package/dist/web/assets/shutter-uhz2Y9S9.ogg +0 -0
- package/dist/web/assets/soclose-CiUFR5St.ogg +0 -0
- package/dist/web/assets/stinger-TnnzHAMN.ogg +0 -0
- package/dist/web/assets/stomp-mzIk4cGm.ogg +0 -0
- package/dist/web/assets/syne-latin-700-normal-AF3Rs61n.woff2 +0 -0
- package/dist/web/assets/syne-latin-800-normal-EehdNYzx.woff2 +0 -0
- package/dist/web/assets/tension-BHvWG5ru.ogg +0 -0
- package/dist/web/assets/tension-bass-4G-2qA9W.ogg +0 -0
- package/dist/web/assets/tension-drums-D7sdehJr.ogg +0 -0
- package/dist/web/assets/tension-harmony-FyPldmLb.ogg +0 -0
- package/dist/web/assets/tension-lead-C5uoFMR8.ogg +0 -0
- package/dist/web/assets/why-clock-Dzs1A_ym.ogg +0 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/index.html +16 -0
- package/dist/web/licenses/OFL-Archivo.txt +93 -0
- package/dist/web/licenses/OFL-DelaGothic.txt +93 -0
- package/dist/web/licenses/OFL-MartianMono.txt +93 -0
- package/package.json +63 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 coauthored contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/PRIVACY.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Privacy & Security Model (`coauthored`)
|
|
2
|
+
|
|
3
|
+
> *"Recorders are read in place. Contents are not copied off this machine. No network requests are made. The resulting report is a file you own and may destroy."*
|
|
4
|
+
|
|
5
|
+
`coauthored` is designed so you can **verify** its privacy guarantees directly rather than taking them on faith.
|
|
6
|
+
|
|
7
|
+
## 1. Two-Zone Architectural Privacy Boundary
|
|
8
|
+
|
|
9
|
+
- **Zone 1 (Isolated Ingestion Subprocess — `src/ingest/worker.ts`):**
|
|
10
|
+
- Spawned with a minimal allowlisted environment and empty `execArgv` (no inherited preloads or inspector flags).
|
|
11
|
+
- Opens ONLY user-approved source locations read-only.
|
|
12
|
+
- Rejects symlinks, junctions, non-regular files, and paths outside canonical allowlisted roots.
|
|
13
|
+
- Extracts strictly structured telemetry metadata (`NormalizedSession`, `NormalizedHumanPrompt`, `NormalizedAgentRequest`, `NormalizedToolCall`, `NormalizedCompaction`, `NormalizedInterrupt`).
|
|
14
|
+
- **Metadata mode is the default.** The worker parses source records that may contain text. It never extracts, stores or transmits the prompt and reply text in this mode. It reads structured fields used for metadata such as timestamps, token counts and tool status.
|
|
15
|
+
- **Optional word counting.** Only after an explicit choice (in the browser, the "Start with word stats" button, which is never pre-selected and never the Enter key's default; in the terminal, `--content` and typing `COUNT`), the worker counts words, phrases, style and emoji from recovered prompt and reply prose in memory. Adapters exclude recognized tool material, file expansions, private reasoning, compact summaries, replays and subagent instructions. Authorship depends on the record formats and their available lineage.
|
|
16
|
+
- Groups project directories internally using `HMAC-SHA256` with a fresh random 32-byte key per run, converts groupings strictly to counts, and zeroes the key before exiting.
|
|
17
|
+
- **Zone 2 (Hardened Loopback Server & Static Web UI — `src/cli/server.ts`, `src/web/`):**
|
|
18
|
+
- Receives a schema-validated `WrappedReport` DTO (`validateWrappedReport`) containing aggregated metrics and a `PrivacyReceipt` keyed by opaque run-scoped IDs (`rec_01`).
|
|
19
|
+
- Raw local filesystem paths are kept in a terminal-only ledger (`--dry-run` / `--privacy-receipt`) and are **never** serialized over HTTP or included in browser responses or share plates.
|
|
20
|
+
|
|
21
|
+
## Optional content chapters
|
|
22
|
+
|
|
23
|
+
- Word counting is asked for once, in the same click that starts the scan. In the browser the source screen offers two equal buttons, "Start with word stats" and "Start without"; neither is pre-selected and pressing Enter never picks the first. The choice travels with that one scan request (`countWords`, required and strictly boolean) and is never remembered. In the terminal, pass `--content` and type `COUNT` after releasing the metadata plan; for automation, use `--confirm --content --confirm-content`. In the browser you get word stats only: phrase candidates are reviewed in the terminal (below), never sent to the local server or the page.
|
|
24
|
+
- **The default JSON export after content consent** (`--inspect-report` or `--export-json`, no review) adds a `content` chapter to the metadata report. It contains:
|
|
25
|
+
- the version of the shipped word lists, and per category the totals, prompt and session counts, 24 hour-of-day and 12 month counts, and the top matched list terms;
|
|
26
|
+
- prompt style numbers (prompt and word counts, one-word prompts and the most common one, length buckets, longest prompt and its month, lowercase, question, caps and exclamation shares, a code-share estimate, stack-trace lines);
|
|
27
|
+
- the top 10 emoji for you and for your agents, with skin tones folded to the base emoji and flags left out;
|
|
28
|
+
- combinations of those counts (peak hours, please per month, thanks before and after long prompts, apologies, streaks, the agents' most common list opener, per-harness catchphrase counts);
|
|
29
|
+
- a receipt: fields read and never read, records and characters seen, skip counts, sketch sizes and the gates.
|
|
30
|
+
- **What stays out of every export:**
|
|
31
|
+
- phrase candidates (unless you keep some, below);
|
|
32
|
+
- safety and redaction counts;
|
|
33
|
+
- flag emoji, the per-script word mix and the languages of thank-yous. These are proxies for nationality, language or identity. They stay in the local report, like safety counts, and never reach a share card.
|
|
34
|
+
- **Your phrases.** `--include-private-phrases` requires a TTY and runs a review inside the worker, so candidates never leave it unreviewed.
|
|
35
|
+
- It prints the number of candidates, then switches to the terminal's alternate screen, so a revealed term never stays in the scrollback.
|
|
36
|
+
- Each candidate starts hidden. Space or Enter reveals it; any other key hides it.
|
|
37
|
+
- After a reveal, keys already waiting or pressed within 300 ms are ignored, and each ignored key restarts that window. Then K keeps the term; H, Enter or any other key hides it. Holding or mashing a key never keeps anything.
|
|
38
|
+
- Hiding a phrase also hides every candidate that shares one of its words, except stopwords such as "the", including candidates you already kept. The summary line says how many were removed this way.
|
|
39
|
+
- Ctrl+C, the end of input, a closed terminal, SIGTERM, or the parent process dying all end the review, restore the terminal, and keep nothing.
|
|
40
|
+
- Only kept candidates are exported. Share cards can include selected curated counts. Censored swear counts require an additional opt-in.
|
|
41
|
+
- The receipt's `rawBytesPersisted: 0` is declared and tested for the content pass. An explicit export writes the fields you chose to keep. Existing private SQLite staging makes temporary copies of approved database files. JavaScript strings are released for collection. The OS may page memory to disk or capture it in a crash dump.
|
|
42
|
+
- **What redaction removes.** Text is NFKC-normalized. Format and default-ignorable characters (zero-width, joiners, soft hyphen, BOM, bidi, tags, variation selectors, U+034F, the Hangul fillers, U+2800) are deleted before redaction, except inside complete standard emoji sequences. The following are then redacted:
|
|
43
|
+
- Rooted paths up to the next quote, newline or sentence end, spaces included: drive, UNC, `~/` or `~\`, `./` or `.\`, `../` or `..\`, `%VAR%\`, `/`, `file://`, and OneDrive or SharePoint folders.
|
|
44
|
+
- Letters-only tokens of 16 or more characters with high entropy or mixed case.
|
|
45
|
+
- Any `sig=`, `token=`, `key=`, `secret=`, `password=` or `auth=` value.
|
|
46
|
+
- The value after a secret keyword (password, passphrase, passcode, pin, pw, pwd, token, secret, API key …), including "the password for prod is …". A value in any common quote pair, typographic and CJK included, is taken whole.
|
|
47
|
+
- Recovery and seed phrases, through the end of the sentence.
|
|
48
|
+
- The word for "password" in French, German, Spanish, Italian, Portuguese, Russian, Chinese, Japanese, Korean, Turkish, Polish and Dutch, with the value after it.
|
|
49
|
+
- Email addresses, including non-ASCII ones.
|
|
50
|
+
- **The phrase veto.** A word can never become a phrase candidate if it appeared anywhere in the run inside an identifier:
|
|
51
|
+
- any token of a path segment (split on `-`, `_`, `.` and camelCase), and spaced folder names between separators;
|
|
52
|
+
- the words of a redacted path, file name, host, email or URL, and words glued to an emoji;
|
|
53
|
+
- a word right next to a separator, `@` or redaction marker;
|
|
54
|
+
- the project and session folder names the metadata already knows;
|
|
55
|
+
- path, file and host words in tool arguments.
|
|
56
|
+
|
|
57
|
+
Tool arguments are read only for this. The veto keeps only keyed HMACs of the words, for one run, and never evicts. If the set fills up, no phrase candidates are offered that run.
|
|
58
|
+
- **Redaction and frequency gates still miss:**
|
|
59
|
+
- names, project nicknames and employer names typed as ordinary words, outside any identifier;
|
|
60
|
+
- folder names written without any separator ("the quokka billing folder");
|
|
61
|
+
- names in scripts without capital letters (for example a Japanese or Chinese name), which the proper-noun filter cannot see;
|
|
62
|
+
- addresses, and secrets that are short (under 16 letters), low-entropy or ordinary words, with no keyword next to them ("pass is …", "passwd velvetotter", "login with velvetotter as the password");
|
|
63
|
+
- secrets split by visible characters (spaces, punctuation, a keycap or other emoji) or disguised with look-alike letters from another script;
|
|
64
|
+
- sync-folder layouts other than OneDrive and SharePoint.
|
|
65
|
+
- **Over-redaction and over-veto are the accepted failures.** Long ordinary words can be redacted (for example "acknowledgements"), and ordinary words next to agent inline code or a redacted value can be vetoed. Both only lose a count. Counts reflect recovered records and may include pasted or quoted prose, or harness material without recognizable boundaries. Review candidates before keeping them. English lexicons are enabled. Other lexicons are available through an internal preview option.
|
|
66
|
+
- **Budgets fail closed.** A message over the text-analysis budget (250 ms, or 4,096 prose tokens) is skipped, and the skip is counted in the receipt (`timeBudgetMessagesSkipped`, `tokenLimitMessagesSkipped`).
|
|
67
|
+
- A skipped message could have held veto words, so a single skip also switches off phrase candidates for that run. The receipt then carries `phraseCandidatesSuppressed: true`, and the terminal review says so.
|
|
68
|
+
- This works for agent replies too, so text an agent echoes, including after a prompt injection, can empty or shrink "your phrases". It can only hide phrases, never reveal or add one.
|
|
69
|
+
- If the content pass fails or runs out of its total budget, export still returns the metadata report with a receipt note, and its main-event line does not claim that nothing was read.
|
|
70
|
+
|
|
71
|
+
## 2. Read-Only SQLite Snapshot Safety (OpenCode & Cursor)
|
|
72
|
+
|
|
73
|
+
- `coauthored` **never** connects SQLite directly to a live harness database path.
|
|
74
|
+
- Approved SQLite databases (plus matched `-wal` sidecars, omitting `-shm`) are copied as raw byte streams into a parent-owned run-private temporary directory after pre/post `stat` quiescence checks. On POSIX systems, the staging directory and staged files are created with `0700`/`0600` permissions; on Windows NTFS, POSIX mode bits are advisory and isolation relies on the per-user `%TEMP%` directory ACLs. Hot rollback `-journal` files are rejected with `SQLITE_HOT_JOURNAL` rather than attempting recovery.
|
|
75
|
+
- Staged copies are opened via Node 24's built-in `node:sqlite` (`DatabaseSync`) with:
|
|
76
|
+
- `readOnly: true`, `allowExtension: false`, `enableDoubleQuotedStringLiterals: false`
|
|
77
|
+
- `enableDefensive(true)`, `PRAGMA query_only = ON`, `PRAGMA trusted_schema = OFF`
|
|
78
|
+
- `setAuthorizer(...)` permitting ONLY `SELECT`/`READ` on explicitly allowlisted conversation metadata tables:
|
|
79
|
+
- **OpenCode:** separate authentication, account, and provider credential tables are blocked at the SQLite authorizer level.
|
|
80
|
+
- **Cursor (`state.vscdb`):** `setAuthorizer(...)` restricts reads to `cursorDiskKV` and `ItemTable`, while SQL `WHERE` key-prefix filtering restricts `ItemTable` queries to AI/composer metadata keys rather than unrelated IDE state keys.
|
|
81
|
+
- Temporary staging directories are deleted by the parent CLI process immediately after the worker exits. A synchronous `process.on('exit')` handler covers a normal exit after an error. Node runs no exit handlers when a signal ends the process, so the terminal modes (`--terminal`, `--inspect-report`, `--export-json`, `--content`) also handle Ctrl+C, SIGTERM and SIGHUP: they stop the worker and delete the staging directories, then exit 130. A hard kill (SIGKILL, Task Manager's End task, a power loss or an OS crash) can still leave a staged copy behind in your temp folder until it is cleaned.
|
|
82
|
+
|
|
83
|
+
## 3. Hardened Localhost HTTP Threat Model
|
|
84
|
+
|
|
85
|
+
Localhost is **not** assumed safe from hostile browser tabs or local probes:
|
|
86
|
+
|
|
87
|
+
- **Loopback & DNS Rebinding Defense:** Binds `127.0.0.1` on an ephemeral port (`exclusive: true`) and validates `req.headersDistinct['host']` contains exactly one header matching `127.0.0.1:<port>`. Rejects duplicate Host headers, `localhost`, foreign hosts, absolute-form URLs, and forwarded headers with `403`.
|
|
88
|
+
- **Cross-Origin / CSRF Defense:** Zero CORS headers (`OPTIONS` rejected with `405`). Every `/api/*` endpoint is `POST`-only JSON (8 KiB max body) requiring exact `Origin: http://127.0.0.1:<port>` and exact `Sec-Fetch-Site: same-origin`.
|
|
89
|
+
- **Token Lifecycle:** A single-use 32-byte CSPRNG bootstrap token (120s TTL) is passed in the URL fragment (`#token=...`, never transmitted in HTTP requests or Referer headers), immediately stripped via `history.replaceState`, and exchanged over `POST /api/session` using `crypto.timingSafeEqual` for an independent 32-byte memory-only session bearer (15 min idle expiry, 60 min hard absolute cap). *Local process caveat:* when `coauthored` auto-launches your browser, the 120s single-use bootstrap URL is passed to the OS opener command and may be briefly visible in local process `argv` to other same-user processes until consumed or expired; pass `--no-open` (or `--terminal`) to avoid launcher `argv` exposure altogether.
|
|
90
|
+
- The bearer authorizes loopback requests. Another holder that can meet the request checks can act as the current session. The token cannot prove that a request came from the user's tab or that it reflects a human decision. Same-user processes may already have direct access to the recorder files.
|
|
91
|
+
- **Deny-by-Default CSP & Offline Guarantee:**
|
|
92
|
+
```http
|
|
93
|
+
Content-Security-Policy: default-src 'self'; script-src 'self'; script-src-attr 'none'; style-src 'self'; style-src-attr 'none'; connect-src 'self'; img-src 'self' data: blob:; font-src 'self'; object-src 'none'; frame-ancestors 'none'; frame-src 'none'; worker-src 'none'; media-src 'none'; manifest-src 'none'; base-uri 'none'; form-action 'none'
|
|
94
|
+
```
|
|
95
|
+
Zero external fonts, scripts, styles, analytics, or network requests occur during execution.
|
|
96
|
+
|
|
97
|
+
## 4. Privacy-Safe Share Plates
|
|
98
|
+
|
|
99
|
+
- Exported PNG and plot-ready SVG plates are generated from `ShareCardData` (`src/report/share.ts`) which excludes raw paths, project names/HMACs, receipt rows, and exact session timestamps.
|
|
100
|
+
- Exact calendar date ranges (`includeWindowLabel`, including exact dates and half-hour clock times in SVG `<desc>` / `altText`), API list-price equivalent cost, harness names, handle labels, and project counts are **OFF by default** and must be explicitly toggled on by the user. By default, exported share plates emit only coarse year-level phrasing without exact calendar dates.
|
|
101
|
+
- SVG exports escape all text and contain zero `<script>`, event handlers, `<foreignObject>`, or external references.
|
|
102
|
+
|
|
103
|
+
## 5. Independent Verification Checklist
|
|
104
|
+
|
|
105
|
+
1. `npx coauthored --dry-run` — verify candidate paths with zero content reads.
|
|
106
|
+
2. `npx coauthored --inspect-report --confirm` — inspect the report JSON that is safe for default export.
|
|
107
|
+
3. Run `npm test` — exercises symlink rejection, SQLite WAL & credential-table authorizer denial, synthetic secret sentinel non-leakage, and all HTTP security invariants (`test/ingest.test.ts`, `test/security-http.test.ts`).
|
package/README.md
CHANGED
|
@@ -1,3 +1,113 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# `coauthored`
|
|
2
|
+
|
|
3
|
+
**Your 2026 Coding Wrapped — 100% local, privacy-first, and zero-config.**
|
|
4
|
+
|
|
5
|
+
Run one command. Tap through your year with AI coding agents as a minimal, kinetic, full-screen story with bold color worlds, interactive reveals, honest receipts, and share-ready posters — **offline-capable, zero accounts, zero API keys, zero uploads.**
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx coauthored
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Want to try it right now on realistic fictional telemetry without touching any local files?
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx coauthored --demo
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Why `coauthored`?
|
|
20
|
+
|
|
21
|
+
Most "AI Wrapped" tools either upload your history to a server for a share link or dump token totals into a generic analytics dashboard.
|
|
22
|
+
|
|
23
|
+
`coauthored` takes a different path:
|
|
24
|
+
|
|
25
|
+
- **One command, zero config:** Discovers supported coding harnesses across macOS, Linux, Windows, and WSL using read-only metadata `stat` checks, asks for explicit consent, and launches a hardened local Story UI on `127.0.0.1`.
|
|
26
|
+
- **Privacy is architectural, not a promise:** Raw prompts, assistant code, diffs, tool arguments, credentials, and raw file paths never cross the ingestion boundary. SQLite stores are never locked or opened at live paths — only read-only private snapshots (including matched `-wal` files) with `node:sqlite` hardening.
|
|
27
|
+
- **Zero npm runtime dependencies, zero install scripts:** Runs on Node.js `>=24.15.0` using built-in `node:sqlite`, `node:http`, `node:crypto`, and prebuilt bundled OFL fonts (`Bricolage Grotesque`, `Syne`, `Plus Jakarta Sans`, `JetBrains Mono`). Zero `node-gyp`, zero CDN calls, zero telemetry.
|
|
28
|
+
- **Honest statistics, never fake hype:** Separates `● Observed` facts, `◐ Estimated` figures (`≈`), and `✦ Interpretation` framing. Detects 30-day log cleanup cliffs honestly (*Captured Window*), never renders absent capabilities as `0`, splits tokens into *Written*, *Read Fresh*, and *Re-read from Cache*, and skips population percentiles we cannot observe.
|
|
29
|
+
- **Minimal, kinetic, share-worthy craft:** Full-viewport story slides with distinct color worlds, living SVG motion layers, an interactive "guess your coding clock" quiz, a 3D flip Persona Card, and a 4-colorway Share Card Studio (`9:16` Story, `4:5` Feed, `1:1` Square, `16:9` X) exporting 2× PNG and crisp SVG with privacy-safe defaults.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Supported Coding Harnesses
|
|
34
|
+
|
|
35
|
+
| Tier | Harness | What is read (metadata only) | Notes |
|
|
36
|
+
| --- | --- | --- | --- |
|
|
37
|
+
| **Tier 1** | **Claude Code** | `~/.claude/projects/.../*.jsonl` + `subagents/` (`CLAUDE_CONFIG_DIR`) | `(message.id, requestId)` streaming dedupe, `compact_boundary`, 5m/1h cache splits, 30-day retention cliff detection |
|
|
38
|
+
| **Tier 1** | **OpenAI Codex CLI** | `~/.codex/sessions/` & `archived_sessions/` (`CODEX_HOME`) | Native `token_usage_record` + legacy cumulative-to-delta baseline reducer, fork replay exclusion |
|
|
39
|
+
| **Tier 1** | **OpenCode** | `opencode.db` (`OPENCODE_DB` / XDG) + legacy JSON | Matched main + `-wal` private snapshot, v1/v2 dedupe, auth/credential tables authorizer-blocked |
|
|
40
|
+
| **Tier 1** | **Gemini CLI** | `~/.gemini/tmp/*/chats/session-*.{json,jsonl}` (`GEMINI_CLI_HOME`) | Revision folding (`$set`/`$patch`/`$rewindTo`), separate `thoughts` tokens, 30-day cleanup detection |
|
|
41
|
+
| **Tier 2** | **Cursor IDE** | `globalStorage/state.vscdb` (`cursorDiskKV` / `ItemTable`) | Private SQLite snapshot, `isSimulatedMsg` exclusion, honest activity-first reporting |
|
|
42
|
+
| **Tier 2** | **Cline & Roo Code** | VS Code `globalStorage/.../tasks/*/ui_messages.json` | Paired `api_req_started`/`api_req_finished` and in-place metadata |
|
|
43
|
+
| **Tier 2** | **Pi Agent** | `~/.pi/agent/sessions/*.jsonl` (`PI_CODING_AGENT_SESSION_DIR`) | Session tree + full input/output/cache usage |
|
|
44
|
+
| **Tier 2** | **Aider** | Explicit `--input` `.aider.chat.history.md` / `--analytics-log` | Activity timestamps + explicit analytics JSONL |
|
|
45
|
+
|
|
46
|
+
Want to add another harness? Every adapter implements the clean `HarnessAdapter` interface in [src/ingest/types.ts](src/ingest/types.ts).
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## CLI Usage
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Default: locate local recorders -> tear the orange seal in browser
|
|
54
|
+
npx coauthored
|
|
55
|
+
|
|
56
|
+
# Interactive demo on 5 fictional 2026 developer profiles (zero local reads)
|
|
57
|
+
npx coauthored --demo
|
|
58
|
+
npx coauthored --demo polyglot # night-owl | polyglot | starter | specialist | partial
|
|
59
|
+
|
|
60
|
+
# Inspect exact paths and field policy with zero content reads
|
|
61
|
+
npx coauthored --dry-run
|
|
62
|
+
|
|
63
|
+
# Terminal-only mode (no HTTP server, explicit RELEASE consent)
|
|
64
|
+
npx coauthored --terminal
|
|
65
|
+
npx coauthored --terminal --privacy-receipt
|
|
66
|
+
|
|
67
|
+
# Inspect or export the exact browser-safe sanitized JSON payload (add --confirm for non-interactive piping)
|
|
68
|
+
npx coauthored --inspect-report --confirm | jq .
|
|
69
|
+
npx coauthored --export-json ./my-2026-wrapped.json
|
|
70
|
+
|
|
71
|
+
# Scan a custom directory or backup (great for WSL or archived logs)
|
|
72
|
+
npx coauthored --input ./archived-logs --year 2026 --tz America/New_York
|
|
73
|
+
npx coauthored --analytics-log ~/.aider.analytics.jsonl
|
|
74
|
+
|
|
75
|
+
# Headless / SSH port forwarding (keeps exact loopback Origin checks)
|
|
76
|
+
npx coauthored --no-open --port 32147
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Verify Privacy in 30 Seconds
|
|
82
|
+
|
|
83
|
+
Read the full inspectable threat model in [PRIVACY.md](PRIVACY.md):
|
|
84
|
+
|
|
85
|
+
1. Run `npx coauthored --dry-run` — confirms discovery reads zero file contents and lists every exact source root.
|
|
86
|
+
2. Run `npx coauthored --inspect-report --confirm` (or `npx coauthored --demo --inspect-report` for synthetic data; add `--confirm` whenever piping non-interactively) — prints the exact sanitized `WrappedReport` JSON that ever reaches the UI.
|
|
87
|
+
3. Run `npx coauthored --no-open`, open DevTools → **Network** in a blank tab before pasting the printed `http://127.0.0.1:<port>/#token=...` URL — confirm every request hits `http://127.0.0.1:<port>` only, inspect the deny-by-default `Content-Security-Policy` header, and click **RECEIPT** in the top bar to inspect the raw JSON payload and `externalBytesSent: 0`.
|
|
88
|
+
4. Disconnect from the internet and run `npx --offline coauthored --demo` — every font, visualization, Web Audio synth, PNG export, and plot-ready SVG works completely offline.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Known Limitations & Honest Notes
|
|
93
|
+
|
|
94
|
+
- **Node.js `>=24.15.0` required:** Uses Node 24's built-in `node:sqlite` authorizer & defensive hardening so there are zero runtime npm dependencies and zero native `node-gyp` builds.
|
|
95
|
+
- **30-day default retention:** Both Claude Code (`cleanupPeriodDays`) and current Gemini CLI (`maxAge: "30d"`) prune older local transcripts by default. When a retention cliff is detected, `coauthored` labels your report honestly as a **Captured Window** instead of extrapolating.
|
|
96
|
+
- **Live cross-platform verification:** Automated test suites and synthetic fixtures cover Windows, POSIX path normalization, SQLite WAL snapshots, and HTTP security; live native macOS, Linux desktop, and WSL2 browser opener behavior should be checked on target hosts.
|
|
97
|
+
- **API-equivalent cost:** Always labeled `◐ Estimated` against our bundled offline catalog dated `2026-12-03` — never presented as your actual subscription or provider invoice, and hidden by default on exported share plates.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Development
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm install
|
|
105
|
+
npm run typecheck
|
|
106
|
+
npm run build
|
|
107
|
+
npm run build:demo # builds self-contained static public showcase in dist/demo/
|
|
108
|
+
npm test
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
MIT — see [LICENSE](LICENSE) and [THIRD_PARTY_LICENSES.md](THIRD_PARTY_LICENSES.md).
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Third-Party Licenses & Notices
|
|
2
|
+
|
|
3
|
+
`coauthored` ships with **zero npm runtime dependencies** in its Node.js CLI.
|
|
4
|
+
The prebuilt static web bundle (`dist/web/` and `dist/demo/`) bundles the following open-source libraries and typefaces locally for 100% offline execution:
|
|
5
|
+
|
|
6
|
+
## Runtime Frontend Bundle
|
|
7
|
+
|
|
8
|
+
- **React & React DOM** (`react`, `react-dom`) — MIT License — Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
|
|
10
|
+
## Bundled Offline Typefaces
|
|
11
|
+
|
|
12
|
+
- **Bricolage Grotesque** (`@fontsource/bricolage-grotesque`) — SIL Open Font License 1.1 — Copyright (c) Mathieu Triay.
|
|
13
|
+
- **Syne** (`@fontsource/syne`) — SIL Open Font License 1.1 — Copyright (c) Bonjour Monde / Lucas Descroix.
|
|
14
|
+
- **Plus Jakarta Sans** (`@fontsource/plus-jakarta-sans`) — SIL Open Font License 1.1 — Copyright (c) Tokotype.
|
|
15
|
+
- **JetBrains Mono** (`@fontsource/jetbrains-mono`) — SIL Open Font License 1.1 — Copyright (c) JetBrains s.r.o.
|
|
16
|
+
- **Archivo** (film) — SIL Open Font License 1.1 — Copyright 2020 The Archivo Project Authors (https://github.com/Omnibus-Type/Archivo). Licence text ships as `licenses/OFL-Archivo.txt`.
|
|
17
|
+
- **Martian Mono** (film) — SIL Open Font License 1.1 — Copyright 2021 The Martian Mono Project Authors (https://github.com/evilmartians/mono). Licence text ships as `licenses/OFL-MartianMono.txt`.
|
|
18
|
+
- **Dela Gothic One** (film) — SIL Open Font License 1.1 — Copyright 2020 The Dela Gothic Project Authors (https://github.com/syakuzen/DelaGothic). Licence text ships as `licenses/OFL-DelaGothic.txt`.
|
|
19
|
+
|
|
20
|
+
## Reference Texts for Written-Token Anchors
|
|
21
|
+
|
|
22
|
+
- Public-domain literary anchor measurements (e.g., *Moby-Dick*, *War and Peace*, *Complete Works of Shakespeare*) and technical RFC constants are bundled as static numeric constants only (no copyrighted text is included).
|
|
23
|
+
|
|
24
|
+
## Content analysis word lists
|
|
25
|
+
|
|
26
|
+
- [LDNOOBW](https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words), © Shutterstock, [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The bundled lists are merged, trimmed and deduplicated, and normalized during matching. Used only to suppress candidates.
|
|
27
|
+
- [Stopwords ISO](https://github.com/stopwords-iso/stopwords-iso), MIT. Selected lists are merged and deduplicated.
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
The MIT License (MIT)
|
|
31
|
+
|
|
32
|
+
Copyright (c) 2020 Gene Diaz
|
|
33
|
+
|
|
34
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
35
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
36
|
+
in the Software without restriction, including without limitation the rights
|
|
37
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
38
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
39
|
+
furnished to do so, subject to the following conditions:
|
|
40
|
+
|
|
41
|
+
The above copyright notice and this permission notice shall be included in all
|
|
42
|
+
copies or substantial portions of the Software.
|
|
43
|
+
|
|
44
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
45
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
46
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
47
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
48
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
49
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
50
|
+
SOFTWARE.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Emoji names
|
|
54
|
+
|
|
55
|
+
- [Unicode Emoji 17.0 test data](https://www.unicode.org/Public/17.0.0/emoji/emoji-test.txt), © 2025 Unicode, Inc. Includes the English names of RGI emoji with three Coauthored label edits. Distributed under the [Unicode License V3](https://www.unicode.org/license.txt).
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
UNICODE LICENSE V3
|
|
59
|
+
|
|
60
|
+
COPYRIGHT AND PERMISSION NOTICE
|
|
61
|
+
|
|
62
|
+
Copyright © 1991-2026 Unicode, Inc.
|
|
63
|
+
|
|
64
|
+
NOTICE TO USER: Carefully read the following legal agreement. BY
|
|
65
|
+
DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
|
|
66
|
+
SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
|
|
67
|
+
TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
|
|
68
|
+
DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
|
|
69
|
+
|
|
70
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
71
|
+
copy of data files and any associated documentation (the "Data Files") or
|
|
72
|
+
software and any associated documentation (the "Software") to deal in the
|
|
73
|
+
Data Files or Software without restriction, including without limitation
|
|
74
|
+
the rights to use, copy, modify, merge, publish, distribute, and/or sell
|
|
75
|
+
copies of the Data Files or Software, and to permit persons to whom the
|
|
76
|
+
Data Files or Software are furnished to do so, provided that either (a)
|
|
77
|
+
this copyright and permission notice appear with all copies of the Data
|
|
78
|
+
Files or Software, or (b) this copyright and permission notice appear in
|
|
79
|
+
associated Documentation.
|
|
80
|
+
|
|
81
|
+
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
82
|
+
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
83
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
84
|
+
THIRD PARTY RIGHTS.
|
|
85
|
+
|
|
86
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
|
|
87
|
+
BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
|
|
88
|
+
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
89
|
+
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
90
|
+
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
|
|
91
|
+
FILES OR SOFTWARE.
|
|
92
|
+
|
|
93
|
+
Except as contained in this notice, the name of a copyright holder shall
|
|
94
|
+
not be used in advertising or otherwise to promote the sale, use or other
|
|
95
|
+
dealings in these Data Files or Software without prior written
|
|
96
|
+
authorization of the copyright holder.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Film score (music)
|
|
100
|
+
|
|
101
|
+
The film's adaptive score, *Shortcut Parade* (adaptive stems, section fills and one-shots from `production/round2/music/adaptive/`, bundled as Ogg Vorbis files in `dist/web/assets/` and `dist/demo/assets/`), is played locally and never streamed.
|
|
102
|
+
|
|
103
|
+
- **Composition, arrangement, synth voices and effects** (including the dialogue act's card, ledger tick, jar coin, review split and Why clock) — original material made for Coauthored 2026 — MIT License, as the rest of this repository.
|
|
104
|
+
- **Acoustic drum recordings** — *Virtuosity Drums* by Versilian Studios LLC and Karoryfer Samples, performed by Austin McMahon — CC0 1.0 Universal (public domain dedication). Pinned source revision `9f04cf9a734527edfbb0a4eee1f674e45bbf71bc` of `github.com/sfzinstruments/virtuosity_drums`; the eleven samples used and their SHA-256 hashes are listed in `production/round2/music/PROVENANCE.md`.
|
|
105
|
+
- The offline render tools (Python, NumPy, SciPy, FFmpeg) are not shipped; the exported audio plays without them.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { estimate } from './dataset.js';
|
|
2
|
+
export const WORDS_PER_TOKEN = 0.75;
|
|
3
|
+
const WORDS_PER_TOKEN_SWANN = 196966 / 258878;
|
|
4
|
+
const COUNTED = 'tiktoken 0.14.0 o200k_base, measured 2026-12-03';
|
|
5
|
+
export const WRITTEN_ANCHORS = [
|
|
6
|
+
{ title: 'The Great Gatsby', words: 50005, tokens: 64919, source: 'https://www.gutenberg.org/ebooks/64317',
|
|
7
|
+
edition: 'Project Gutenberg 64317 plain text', sha256: '4a1d4acb31593be9582b392572b08f7aa9f5ee0587ad50b2a0adbcc3712a951a' },
|
|
8
|
+
{ title: 'RFC 9110', words: 72749, tokens: 117311, source: 'https://www.rfc-editor.org/rfc/rfc9110.txt',
|
|
9
|
+
edition: 'IETF HTTP Semantics, full plain text', sha256: '21c1cdce6ab0e5509b04d84a28000836c7a087cf786efe6f04877ebfff47232a' },
|
|
10
|
+
{ title: 'Moby-Dick', words: 219456, tokens: 305432, source: 'https://www.gutenberg.org/ebooks/2701',
|
|
11
|
+
edition: 'Project Gutenberg 2701 plain text, including front and back matter', sha256: 'f12eb530502755ef2b8f535e2ecef3e95802eab584e60ac7992ccf856256fdbe' },
|
|
12
|
+
{ title: 'The Lord of the Rings', words: 480000, tokens: Math.round(480000 * 305432 / 219456), source: 'https://www.tolkienestate.com/writing/the-lord-of-the-rings/',
|
|
13
|
+
edition: 'Three-volume English text, approximate word count scaled by the measured Moby-Dick ratio' },
|
|
14
|
+
{ title: 'War and Peace', words: 573435, tokens: 765705, source: 'https://www.gutenberg.org/ebooks/2600',
|
|
15
|
+
edition: 'Project Gutenberg 2600, Maude English translation', sha256: 'e4bcf9042609b62c7de72a6f1b311f54c412943a9d641b7efcf79a464b5f31c8' },
|
|
16
|
+
{ title: 'Complete Works of Shakespeare', words: 992904, tokens: 1436260, source: 'https://www.gutenberg.org/ebooks/100',
|
|
17
|
+
edition: 'Project Gutenberg 100 plain text, including stage directions and speaker labels', sha256: 'a023115c2d4e2ee12221bdd780fdf2ac5a864fe225948656f51f8be462c7fffb' },
|
|
18
|
+
{ title: 'In Search of Lost Time', words: 1250000, tokens: Math.round(1250000 / WORDS_PER_TOKEN_SWANN), source: 'https://www.gutenberg.org/ebooks/7178',
|
|
19
|
+
edition: 'Estimated for the English cycle using the measured ratio of Swann’s Way, Scott Moncrieff translation',
|
|
20
|
+
calibrationSha256: '19bc9b413004d3a32429f1feb5fc32d1ef3255415cea6d6d28a0b18fbddd5f62' },
|
|
21
|
+
];
|
|
22
|
+
export function pickWrittenAnchor(writtenTokens) {
|
|
23
|
+
if (!Number.isFinite(writtenTokens) || writtenTokens <= 0)
|
|
24
|
+
return null;
|
|
25
|
+
const candidates = WRITTEN_ANCHORS.map((anchor) => {
|
|
26
|
+
const multiple = writtenTokens / anchor.tokens;
|
|
27
|
+
return { anchor, multiple, distance: Math.abs(Math.round(multiple) - multiple) };
|
|
28
|
+
}).filter(({ multiple }) => multiple >= 1.5 && multiple <= 60);
|
|
29
|
+
candidates.sort((a, b) => a.distance - b.distance || a.multiple - b.multiple);
|
|
30
|
+
const chosen = candidates[0];
|
|
31
|
+
if (!chosen)
|
|
32
|
+
return null;
|
|
33
|
+
const { anchor, multiple } = chosen;
|
|
34
|
+
return {
|
|
35
|
+
anchorTitle: anchor.title, multiple,
|
|
36
|
+
metaphorCopy: `Your agents’ written output would fill ≈ ${estimate(multiple)} copies of ${anchor.title}.`,
|
|
37
|
+
methodNote: `Written output tokens divided by ≈ ${anchor.tokens.toLocaleString('en-US')} reference tokens. ${anchor.edition}, ${anchor.words.toLocaleString('en-US')} word units. ${COUNTED}. Tokenizer and edition affect the comparison.${'sha256' in anchor ? '' : ' Approximate word count and tokenizer ratio, with a ±15% editorial uncertainty band.'}`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { estimate, median, pct } from './dataset.js';
|
|
2
|
+
import { gini, normalizedEntropy } from './statistics.js';
|
|
3
|
+
import { spanMinutes } from './time.js';
|
|
4
|
+
const labels = {
|
|
5
|
+
spawns: ['Subagent launches per 100 prompts', estimate], parallel: ['Parallelism factor', (n) => `≈ ${estimate(n)}×`],
|
|
6
|
+
leash: ['Median agent actions per prompt', estimate], promptRate: ['Prompts per active hour', (n) => `≈ ${estimate(n)}`],
|
|
7
|
+
readEdit: ['Investigate calls per modify call', estimate], modify: ['Modify share', pct],
|
|
8
|
+
session: ['Median active minutes per session', (n) => `≈ ${estimate(n)}`], execute: ['Execute share', pct],
|
|
9
|
+
deep: ['Active time in sessions of at least 90 minutes', pct], compact: ['Compactions per 10 sessions', estimate],
|
|
10
|
+
harness: ['Harness mix entropy', estimate], model: ['Model family entropy', estimate],
|
|
11
|
+
active: ['Share of qualifying coding days', pct], gini: ['Daily activity Gini', estimate],
|
|
12
|
+
surge: ['Peak day divided by median active day', (n) => `≈ ${estimate(n)}×`],
|
|
13
|
+
};
|
|
14
|
+
const exact = (value) => String(value);
|
|
15
|
+
const s = (value, lo, hi) => Math.max(0, Math.min(1, (value - lo) / (hi - lo)));
|
|
16
|
+
const spec = [
|
|
17
|
+
{ id: 'conductor', name: 'Conductor', tagline: 'Less typing, more orchestrating.', terms: [['spawns', 2, 25, 0.6], ['parallel', 1.2, 3, 0.4]] },
|
|
18
|
+
{ id: 'deep-diver', name: 'Deep Diver', tagline: 'Living on the edge of the context window.', terms: [['deep', 0.25, 0.65, 0.5], ['compact', 0.5, 4, 0.5]] },
|
|
19
|
+
{ id: 'architect', name: 'Architect', tagline: 'Write the spec, let the agent build.', terms: [['leash', 6, 25]] },
|
|
20
|
+
{ id: 'nomad', name: 'Nomad', tagline: 'Zero brand loyalty, maximum curiosity.', terms: [['harness', 0.3, 0.8, 0.6], ['model', 0.4, 0.85, 0.4]] },
|
|
21
|
+
{ id: 'archaeologist', name: 'Archaeologist', tagline: 'Reads the whole repo before touching a line.', terms: [['readEdit', 2, 6]] },
|
|
22
|
+
{ id: 'shell-whisperer', name: 'Shell Whisperer', tagline: 'Terminal first, everything else second.', terms: [['execute', 0.30, 0.55]] },
|
|
23
|
+
{ id: 'surgeon', name: 'Surgeon', tagline: 'In, out, clean diff.', terms: [['modify', 0.25, 0.45, 0.6], ['session', 45, 10, 0.4]] },
|
|
24
|
+
{ id: 'pair-programmer', name: 'Pair Programmer', tagline: 'Tight loops, hands on the wheel.', terms: [['leash', 4, 1], ['promptRate', 4, 15]], product: true },
|
|
25
|
+
{ id: 'sprinter', name: 'Sprinter', tagline: 'Quiet stretch, then an all-out sprint.', terms: [['gini', 0.55, 0.85], ['surge', 3, 10]], product: true },
|
|
26
|
+
{ id: 'metronome', name: 'Metronome', tagline: 'Shows up every single day. No drama.', terms: [['active', 0.4, 0.85, 0.5], ['gini', 0.6, 0.3, 0.5]] },
|
|
27
|
+
];
|
|
28
|
+
export function classifyOperator(d, density, rhythm, craft, delegation, evolution) {
|
|
29
|
+
const count = d.parentSessions.length;
|
|
30
|
+
const human = d.humanPrompts.length;
|
|
31
|
+
const sessionMinutes = d.parentSessions.map((session) => spanMinutes(d.active.perSession.get(session.sessionId) ?? []));
|
|
32
|
+
const allSessionMinutes = [...d.active.perSession.values()].map(spanMinutes);
|
|
33
|
+
const daily = d.days.map((date) => d.codingMinutes.get(date) ?? 0);
|
|
34
|
+
if (d.days[0]) {
|
|
35
|
+
const precedingDay = d.codingDate(d.events[0].tsMs);
|
|
36
|
+
if (precedingDay < d.days[0])
|
|
37
|
+
daily.unshift(d.codingMinutes.get(precedingDay) ?? 0);
|
|
38
|
+
}
|
|
39
|
+
const medianDay = median(daily.filter((n) => n > 0));
|
|
40
|
+
const toolCount = craft.toolMix.reduce((n, t) => n + t.count, 0);
|
|
41
|
+
const share = (family) => craft.toolMix.find((t) => t.family === family)?.share ?? 0;
|
|
42
|
+
const familyCount = evolution.modelRiver.families.length;
|
|
43
|
+
const harnessCount = evolution.harnessPolyglot.harnessCount;
|
|
44
|
+
const minutes = d.active.wallClockActiveMinutes;
|
|
45
|
+
const full = d.capabilities;
|
|
46
|
+
const values = {
|
|
47
|
+
spawns: full.subagentSpawns === 'present' && full.humanPromptTimestamps === 'present' && human ? 100 * delegation.orchestra.totalSpawns / human : null,
|
|
48
|
+
parallel: d.active.parallelismFactor,
|
|
49
|
+
leash: craft.leashLength.eligible && full.humanPromptTimestamps === 'present' &&
|
|
50
|
+
full[craft.leashLength.unit === 'tool-calls' ? 'toolNames' : 'agentRequestTimestamps'] === 'present' ? craft.leashLength.median : null,
|
|
51
|
+
promptRate: full.humanPromptTimestamps === 'present' && minutes ? human * 60 / minutes : null,
|
|
52
|
+
readEdit: full.toolNames === 'present' && toolCount ? share('investigate') / Math.max(share('modify'), 0.01) : null,
|
|
53
|
+
modify: full.toolNames === 'present' && toolCount ? share('modify') : null,
|
|
54
|
+
execute: full.toolNames === 'present' && toolCount ? share('execute') : null,
|
|
55
|
+
session: sessionMinutes.length ? median(sessionMinutes) : null,
|
|
56
|
+
deep: d.active.agentActiveMinutes ? allSessionMinutes.filter((n) => n >= 90).reduce((a, b) => a + b, 0) / d.active.agentActiveMinutes : null,
|
|
57
|
+
compact: full.compactions === 'present' && count ? 10 * delegation.cliffDiving.totalCompactions / count : null,
|
|
58
|
+
harness: full.humanPromptTimestamps === 'present' && evolution.harnessPolyglot.shares.length ? 1 - evolution.harnessPolyglot.loyaltyIndex : null,
|
|
59
|
+
model: full.modelIds === 'present' && familyCount ? normalizedEntropy(evolution.modelRiver.families.map((m) => m.totalRequests)) : null,
|
|
60
|
+
active: full.humanPromptTimestamps === 'present' && daily.length ? rhythm.streaks.activeDayRatio : null,
|
|
61
|
+
gini: daily.length ? gini(daily) : null,
|
|
62
|
+
surge: medianDay ? Math.max(...daily) / medianDay : null,
|
|
63
|
+
};
|
|
64
|
+
function gate(id, v) {
|
|
65
|
+
switch (id) {
|
|
66
|
+
case 'conductor': return (v.spawns ?? 0) >= 2 || (v.parallel ?? 0) >= 1.5;
|
|
67
|
+
case 'architect':
|
|
68
|
+
case 'pair-programmer': return human >= 50;
|
|
69
|
+
case 'archaeologist':
|
|
70
|
+
case 'surgeon':
|
|
71
|
+
case 'shell-whisperer': return toolCount >= 100;
|
|
72
|
+
case 'deep-diver': return count >= 10;
|
|
73
|
+
case 'nomad': return harnessCount >= 2 || familyCount >= 3;
|
|
74
|
+
case 'sprinter':
|
|
75
|
+
case 'metronome': return d.capturedWindow.daysSpanned >= 28;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function scoreAll(v) {
|
|
79
|
+
return spec.map((profile) => {
|
|
80
|
+
const terms = profile.terms.filter(([feature]) => v[feature] !== null);
|
|
81
|
+
const available = terms.length === profile.terms.length ||
|
|
82
|
+
((profile.id === 'deep-diver' || profile.id === 'conductor' || profile.id === 'nomad') && terms.length > 0);
|
|
83
|
+
const eligible = available && gate(profile.id, v);
|
|
84
|
+
const totalWeight = profile.product ? 1 : terms.reduce((n, term) => n + (term[3] ?? 1), 0) || 1;
|
|
85
|
+
const chips = terms.map(([feature, lo, hi, weight = 1]) => {
|
|
86
|
+
const raw = v[feature];
|
|
87
|
+
return {
|
|
88
|
+
feature, raw, lo, hi,
|
|
89
|
+
contribution: s(raw, lo, hi) * (profile.product ? 1 : weight / totalWeight),
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
const score = !available ? 0 : profile.product ? chips.reduce((n, c) => n * c.contribution, 1) : chips.reduce((n, c) => n + c.contribution, 0);
|
|
93
|
+
return { ...profile, eligible, score, chips };
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function pick(scores) {
|
|
97
|
+
const highest = Math.max(0, ...scores.filter((a) => a.eligible).map((a) => a.score));
|
|
98
|
+
return scores.find((a) => a.eligible && a.score >= 0.5 && a.score >= highest - 0.03);
|
|
99
|
+
}
|
|
100
|
+
const scores = scoreAll(values);
|
|
101
|
+
const rookie = density === 'micro' || count < 10;
|
|
102
|
+
const winner = rookie ? undefined : pick(scores);
|
|
103
|
+
const bestSignal = [...scores].filter((a) => a.eligible).sort((a, b) => b.score - a.score)[0];
|
|
104
|
+
const runner = [...scores].filter((a) => a.id !== winner?.id && a.eligible && a.score >= 0.4).sort((a, b) => b.score - a.score)[0];
|
|
105
|
+
const id = winner?.id ?? (rookie ? 'rookie' : 'free-radical');
|
|
106
|
+
const name = winner?.name ?? (rookie ? 'Rookie Card' : 'Free Radical');
|
|
107
|
+
const chronotype = rhythm.solarNoon.chronotype;
|
|
108
|
+
const title = winner && chronotype ? `${chronotype} ${name}` : name;
|
|
109
|
+
const strongest = (winner ?? bestSignal)?.chips.toSorted((a, b) => b.contribution - a.contribution).map(({ feature, raw, lo, hi, contribution }) => ({
|
|
110
|
+
feature: labels[feature][0], rawValue: `${exact(raw)} (anchors ${exact(lo)} to ${exact(hi)})`, contribution,
|
|
111
|
+
})) ?? [];
|
|
112
|
+
let whatWouldChangeIt = rookie
|
|
113
|
+
? 'A full classification needs at least 11 recorded parent sessions across at least six observed days. Individual archetypes also have their own evidence thresholds.'
|
|
114
|
+
: 'The recorded signals determine the classification against fixed editorial anchors.';
|
|
115
|
+
if (!rookie) {
|
|
116
|
+
let change;
|
|
117
|
+
const terms = spec.flatMap((a) => a.terms);
|
|
118
|
+
for (const [feature, lo, hi] of terms) {
|
|
119
|
+
const current = values[feature];
|
|
120
|
+
if (current === null)
|
|
121
|
+
continue;
|
|
122
|
+
for (const anchor of [lo, hi]) {
|
|
123
|
+
const next = pick(scoreAll({ ...values, [feature]: anchor }));
|
|
124
|
+
if (!next || next.id === winner?.id)
|
|
125
|
+
continue;
|
|
126
|
+
let near = 0, far = 1;
|
|
127
|
+
for (let i = 0; i < 24; i++) {
|
|
128
|
+
const mid = (near + far) / 2;
|
|
129
|
+
if (pick(scoreAll({ ...values, [feature]: current + mid * (anchor - current) }))?.id === next.id)
|
|
130
|
+
far = mid;
|
|
131
|
+
else
|
|
132
|
+
near = mid;
|
|
133
|
+
}
|
|
134
|
+
const value = current + far * (anchor - current);
|
|
135
|
+
const distance = Math.abs(value - current) / Math.abs(hi - lo);
|
|
136
|
+
if (!change || distance < change.distance)
|
|
137
|
+
change = { name: next.name, feature, value, distance };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (change) {
|
|
141
|
+
const [label, format] = labels[change.feature];
|
|
142
|
+
whatWouldChangeIt = `${change.name} would take the lead if ${label.toLowerCase()} reached about ${format(change.value).replace(/^≈ /, '')}, with the other recorded features held fixed.`;
|
|
143
|
+
}
|
|
144
|
+
else if (runner) {
|
|
145
|
+
whatWouldChangeIt = `${runner.name} is the nearest qualifying alternative at ${runner.score.toFixed(2)}. The single-feature scenarios tested at the editorial anchors kept the current lead.`;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const extra = (feature, rawValue) => ({ feature, rawValue: String(rawValue), contribution: 0 });
|
|
149
|
+
const longestSession = sessionMinutes.reduce((longest, minutes) => Math.max(longest, minutes), 0);
|
|
150
|
+
const supporting = {
|
|
151
|
+
conductor: [
|
|
152
|
+
...(delegation.orchestra.totalSpawns ? [extra('Recorded subagent launches', delegation.orchestra.totalSpawns)] : []),
|
|
153
|
+
...(delegation.orchestra.maxConcurrent ? [extra('Peak concurrent subagents', delegation.orchestra.maxConcurrent)] : []),
|
|
154
|
+
],
|
|
155
|
+
'deep-diver': [
|
|
156
|
+
extra('Longest session active minutes', `≈ ${longestSession}`),
|
|
157
|
+
...(delegation.cliffDiving.medianTurnsAfter !== null ? [extra('Sessions continuing after compaction', delegation.cliffDiving.survivedSessions)] : []),
|
|
158
|
+
],
|
|
159
|
+
architect: [extra('Longest recorded leash action count', craft.leashLength.maxCount)],
|
|
160
|
+
nomad: [extra('Observed harnesses', harnessCount), ...(evolution.modelRiver.migration.weekStart ? [extra('Migration week', evolution.modelRiver.migration.weekStart)] : [])],
|
|
161
|
+
archaeologist: [extra('Recorded investigate calls', craft.toolMix.find((t) => t.family === 'investigate')?.count ?? 0),
|
|
162
|
+
extra('Recorded modify calls', craft.toolMix.find((t) => t.family === 'modify')?.count ?? 0)],
|
|
163
|
+
'shell-whisperer': craft.bounceBack.nemesisFamily === 'execute' && craft.bounceBack.nemesisErrorRate !== null
|
|
164
|
+
? [extra('Recorded execute error share', craft.bounceBack.nemesisErrorRate)] : [],
|
|
165
|
+
surgeon: [],
|
|
166
|
+
'pair-programmer': [extra('Recorded human prompts', human)],
|
|
167
|
+
sprinter: [extra('Peak daily active minutes', `≈ ${Math.max(0, ...daily)}`)],
|
|
168
|
+
metronome: rhythm.streaks.longestStreakRange ? [extra('Longest recorded coding streak', rhythm.streaks.longestStreakDays)] : [],
|
|
169
|
+
};
|
|
170
|
+
const lead = winner ?? bestSignal;
|
|
171
|
+
const body = {
|
|
172
|
+
conductor: `${delegation.orchestra.totalSpawns} recorded launches${delegation.orchestra.maxConcurrent ? `, up to ${delegation.orchestra.maxConcurrent} active together` : ''}.`,
|
|
173
|
+
'deep-diver': `The longest measured session covered ≈ ${estimate(longestSession)} active minutes.`,
|
|
174
|
+
architect: `A median of ${craft.leashLength.median} recorded actions followed each covered prompt.`,
|
|
175
|
+
nomad: `${harnessCount} harnesses and ${familyCount} measured model families appear in the record.`,
|
|
176
|
+
archaeologist: values.readEdit === null ? 'Investigate calls led the recorded tool mix.' : `The investigate-to-modify scoring ratio was ${estimate(values.readEdit)} to 1.`,
|
|
177
|
+
'shell-whisperer': `${pct(share('execute'))} of measured tool calls went to the execute family.`,
|
|
178
|
+
surgeon: `${pct(share('modify'))} modify calls, with a median of ≈ ${estimate(values.session ?? 0)} active minutes per session.`,
|
|
179
|
+
'pair-programmer': `A median of ${craft.leashLength.median} agent actions separated covered human prompts.`,
|
|
180
|
+
sprinter: `Peak daily activity was ≈ ${estimate(values.surge ?? 0)}× the median active day.`,
|
|
181
|
+
metronome: `${pct(rhythm.streaks.activeDayRatio)} of coding days met the human prompt and active-time thresholds.`,
|
|
182
|
+
};
|
|
183
|
+
return {
|
|
184
|
+
id, title, chronotype, archetypeName: name, isProvisional: rookie,
|
|
185
|
+
tagline: winner?.tagline ?? (rookie ? 'Investigation ongoing.' : 'The record resists a single classification.'),
|
|
186
|
+
body: winner ? body[winner.id] : rookie
|
|
187
|
+
? `Recorded sessions so far: ${count}.${bestSignal ? ` Early signals point toward ${bestSignal.name}.` : ''}`
|
|
188
|
+
: 'The qualifying signals stayed below the classification threshold.',
|
|
189
|
+
runnerUp: !rookie && runner ? { name: runner.name, score: runner.score } : null,
|
|
190
|
+
evidence: [...strongest, ...(lead ? supporting[lead.id] : [])].slice(0, 3), whatWouldChangeIt,
|
|
191
|
+
allScores: scores.map(({ id: typeId, name: profileName, score, eligible }) => ({ id: typeId, name: profileName, score, eligible })),
|
|
192
|
+
};
|
|
193
|
+
}
|