@ascenda-one/history-import 0.1.40 → 0.1.42

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
@@ -1,7 +1,8 @@
1
1
  # @ascenda-one/history-import
2
2
 
3
3
  Retrospective AI-usage import: extracts the baseline that already exists on
4
- an engineer's machine — Claude Code transcripts, Codex CLI rollouts, Cursor's
4
+ an engineer's machine — Claude Code transcripts, Codex CLI rollouts, Copilot
5
+ CLI session logs, Cursor's
5
6
  conversation store, VS Code local history and Copilot sessions, git — and
6
7
  ships it as provenance-classed historical events on the existing telemetry
7
8
  wire.
@@ -23,12 +24,13 @@ command (same pattern as hooks pairing) and this CLI does the reading.
23
24
  1. **Evaporation order.** Claude Code first — its 30-day rolling purge is
24
25
  deleting a day of baseline per day. Then Codex (no purge observed on its
25
26
  rollouts; it sits second because it is the same transcript shape and
26
- costs nothing to read, not because of measured risk), then Cursor, then
27
- VS Code, then git.
27
+ costs nothing to read, not because of measured risk), then Copilot CLI,
28
+ then Cursor, then VS Code, then git.
28
29
  2. **Copy, then parse.** Extraction only ever reads a staged snapshot
29
30
  (`src/staging.ts`), never live files. SQLite snapshots carry their `-wal`.
30
31
  3. **Sniff per record, dispatch on the self-labelled version** (`version` on
31
- Claude lines, `cli_version` on a Codex rollout's `session_meta`, `_v` on
32
+ Claude lines, `cli_version` on a Codex rollout's `session_meta`, `version`
33
+ on a Copilot CLI log's `session.start` (1 is the only one seen), `_v` on
32
34
  Cursor records, `version: 1` in VS Code entries).
33
35
  Unknown shapes become `historical_unparsed` — raw retained in staging,
34
36
  nothing inferred. Fixture tests per known (tool, version) pair.
@@ -59,11 +61,12 @@ command (same pattern as hooks pairing) and this CLI does the reading.
59
61
  | `archive` (durable content-addressed copy, dedup, verify, restore, prune) | **implemented; exercised against a real multi-GB store** |
60
62
  | **Claude Code extractor** (human-prompt/tool-result split, session folds incl. recursive subagent transcripts and older flat `agent-*.jsonl` ones, SDK-written prompts counted apart from typed ones, cache-write and advisor tokens, after-hours, compaction, tool failures, context-window peak, human-corrected edits, correction cadence, gap-split active minutes, epoch marker) | **implemented; exercised end to end against the ingest API** |
61
63
  | **Codex extractor** (`~/.codex/sessions` and `archived_sessions` rollouts: `user_message` prompts, per-turn model mix, issued tool calls, tool and runtime failures, cumulative tokens (left off for rollouts that predate them), context peak against the window the rollout itself records, compaction items, long turns, gap-split active minutes, epoch marker) | **implemented; fixture-tested and run against a developer machine's rollouts** |
64
+ | **Copilot CLI extractor** (`~/.copilot/session-state` logs, both the per-session directory and the older flat `<id>.jsonl`: `user.message` prompts counted and never read, one `ai_tool_call_started` per call id, failures from `success: false`, the model that served each message beside the one the person picked (`auto` reads `router:auto`), tokens and line counts from `session.shutdown` (left off when a session never shut down), posture from `permission.requested`, `client_name`, gap-split active minutes, epoch marker) | **implemented; fixture-tested and run against a developer machine's sessions** |
62
65
  | **Active-time split** (hands-on vs agent-supervising, per session, per local day and per project digest; autonomy bands off the transcript's own `permissionMode`) | **implemented; exercised against a real store** |
63
66
  | **Tool-call counting, all four stores** (`tool_use` items / tool-call `response_item`s / `toolFormerData` / `toolInvocationSerialized`, one `ai_tool_call_started` per call) | **implemented; exercised end to end against all four stores on a developer machine** |
64
67
  | **Batch shipper** (`POST /v1/tool-events/batch`, salted hashes, stable importKey) | **implemented; exercised end to end against the ingest API** |
65
68
  | **Cursor extractor** (composerHeaders + bubble aggregation via SQL-side `json_extract`, prompt text never parsed into the process, subagent-composer folding, sessions started at their first message, tokens left off when the build recorded none, epoch marker) | **implemented; exercised end to end against the ingest API** |
66
- | **VS Code extractor** (Timeline-history Chat-Edit day×workspace aggregation, Copilot chatSessions folding (including chats with no folder open, and Insiders and VSCodium installs), workspace identity via `workspace.json` longest-prefix match, epoch marker) | **implemented; exercised end to end against the ingest API** |
69
+ | **VS Code extractor** (Timeline-history Chat-Edit day×workspace aggregation, Copilot chatSessions folding (including chats with no folder open, and Insiders and VSCodium installs; output tokens, largest prompt, credits, reasoning effort and mode where a request recorded them; tool calls dated by the round that issued them), workspace identity via `workspace.json` longest-prefix match, epoch marker) | **implemented; exercised end to end against the ingest API** |
67
70
  | `import [--ship]` end to end | **implemented; exercised end to end against all three stores, dry run and `--ship`, on a developer machine** |
68
71
  | git extractor | stub — throws with a pointer |
69
72
  | zsh `EXTENDED_HISTORY` apply | snippet only |
@@ -335,6 +338,12 @@ boundaries and carried forward between them, and supervising minutes are banded
335
338
  by it through `autonomyBand`. Time before the first declaration lands in
336
339
  `unknown` and is never folded into a neighbouring band.
337
340
 
341
+ Copilot CLI writes posture on `permission.requested` instead, as `agentMode`
342
+ and `permissionMode`. `permissionMode: "manual"` asks before every tool and
343
+ bands as supervised; `agentMode: "plan"` bands as planning. Any other pair
344
+ keeps the CLI's words and lands in `unknown` until someone has seen what it
345
+ does.
346
+
338
347
  The band map rides in the local handoff only (`autonomySplit`), never on the
339
348
  wire: banding is a reader's vocabulary derived from the stored token at query
340
349
  time, and storing the band would freeze a decision deliberately left open.
@@ -423,7 +432,7 @@ ascenda-history-import scan # human-readable inventory
423
432
  ascenda-history-import scan --json # what the app's consent surface renders
424
433
  ascenda-history-import fix-retention # dry-run; --apply to write
425
434
  ascenda-history-import import # Claude Code + Codex + Cursor + VS Code, dry run; --ship to send
426
- ascenda-history-import import --git # also read your own commit metadata from repos your sessions ran in; off by default
435
+ ascenda-history-import import --git # also send your own commit metadata from repos your sessions ran in; needs git on your grant
427
436
  ascenda-history-import archive # the durable copy; --verify / --list / --restore <dir> / --prune
428
437
  ascenda-history-import schedule install # a recurring import --ship; also: remove, status
429
438
  ```
@@ -454,6 +463,27 @@ after day nine.
454
463
  There is no handoff file without the Flow app, and the output says so as
455
464
  a normal line, not a warning.
456
465
 
466
+ ### Git history
467
+
468
+ `--git` adds your own commits from the repositories your agent sessions ran
469
+ in. Each one sends its time, a size bucket, the number of files changed and
470
+ whether it's a merge. No messages, paths, names or emails. Only commits whose
471
+ author email matches the repository's `git config user.email` count.
472
+
473
+ Git is its own box on your history-import grant, and it starts unticked. You
474
+ tick it on the page where you confirm a study join. If it isn't ticked, the
475
+ server refuses those commits with `consent_source_not_granted`. The importer
476
+ then says git wasn't granted, prints the command to join again and tick the
477
+ box, and keeps shipping your other stores:
478
+
479
+ ```
480
+ npx -y @ascenda-one/history-import participate <code> --rejoin
481
+ ```
482
+
483
+ You can take git off later by granting again without it. The server refuses
484
+ new commits from then on. Commits it already took stay until you revoke the
485
+ whole history-import consent.
486
+
457
487
  ### A recurring import
458
488
 
459
489
  ```
@@ -467,6 +497,13 @@ macOS gets a launchd agent in `~/Library/LaunchAgents`, Linux a systemd user
467
497
  timer in `~/.config/systemd/user`. Windows gets the `schtasks` command printed
468
498
  and nothing written. Output goes to `~/.ascenda/logs/history-import.log`.
469
499
 
500
+ `install` asks the server whether your grant covers git, using the join
501
+ `participate` saved in `~/.ascenda/participation.json`. If it does, the job
502
+ runs `import --ship --git`. If it doesn't, or there's no join to ask about,
503
+ the job leaves git out. The choice is fixed when you install, so after you
504
+ change the grant, run `schedule install` again. `schedule status` says
505
+ whether the installed job includes git.
506
+
470
507
  Claude Code deletes transcripts after `cleanupPeriodDays`, 30 unless set. The
471
508
  default is 14 days so one run can fail and the next still lands inside the
472
509
  window. `install` refuses an interval where the retention doesn't cover two
@@ -506,6 +543,19 @@ summary:
506
543
  agent even on a machine with several paired tools, and renews its token
507
544
  the same way.
508
545
 
546
+ Git goes in only when your grant covers it. Before the confirm link, the
547
+ output says the page has an unticked git box and what it would send. After
548
+ the join, `participate` reads `importStores` from the join's status and
549
+ adds `--git` when that list has `git` in it. This command never ticks the
550
+ box for you. The summary has a `Git` line that says whether git went in,
551
+ and why.
552
+
553
+ On a re-run, the grant is read again from the server, using the join
554
+ session saved in `participation.json`, because it can change after the
555
+ join: you can narrow it, or grant git from somewhere else. If the server
556
+ can't be reached, the last answer saved in that file is used. A file with
557
+ neither, from an older release, leaves git out and says it couldn't tell.
558
+
509
559
  Confirms: one in the browser per agent not yet paired, and nothing extra for
510
560
  the study. Installations can't share a token, because renewing one revokes the
511
561
  old, so each agent still needs its own pairing. The join belongs to you, not
@@ -31,6 +31,9 @@ export const ACTIVE_TIME_FIGURES = {
31
31
  "CodexHandoffSession.activeMinutes": "coverage",
32
32
  "CodexHandoffSession.handsOnMinutes": "hands_on",
33
33
  "CodexHandoffSession.agentSupervisingMinutes": "supervising",
34
+ "CopilotCliHandoffSession.activeMinutes": "coverage",
35
+ "CopilotCliHandoffSession.handsOnMinutes": "hands_on",
36
+ "CopilotCliHandoffSession.agentSupervisingMinutes": "supervising",
34
37
  // Summed over sessions, from the sessions' own minute figures. Sessions
35
38
  // overlap, so these routinely exceed the wall clock of the period they
36
39
  // describe, which is why they are agent-hours and not time.
@@ -74,6 +77,7 @@ export const ACTIVE_TIME_FIGURES = {
74
77
  export const NOT_ACTIVE_TIME_FIGURES = {
75
78
  "HandoffFile.activeGapMinutes": "the gap rule these figures were cut by, not a figure",
76
79
  "CodexHandoffFile.activeGapMinutes": "the gap rule these figures were cut by, not a figure",
80
+ "CopilotCliHandoffFile.activeGapMinutes": "the gap rule these figures were cut by, not a figure",
77
81
  "CrossStoreElapsedFile.activeGapMinutes": "the gap rule these figures were cut by, not a figure"
78
82
  };
79
83
  /** The quantity a figure reports, or undefined when it is not registered. */
@@ -1 +1 @@
1
- {"version":3,"file":"activeTimeFigures.js","sourceRoot":"","sources":["../src/activeTimeFigures.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAE3B,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAwD;IACtF,yEAAyE;IACzE,0EAA0E;IAC1E,oEAAoE;IACpE,8BAA8B,EAAE,UAAU;IAC1C,+BAA+B,EAAE,UAAU;IAC3C,wCAAwC,EAAE,aAAa;IAEvD,mCAAmC,EAAE,UAAU;IAC/C,oCAAoC,EAAE,UAAU;IAChD,6CAA6C,EAAE,aAAa;IAE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