sessiongraph 1.0.15 → 1.0.17

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 (41) hide show
  1. package/PRIVACY.md +15 -61
  2. package/README.md +36 -56
  3. package/bin/sessiongraph.mjs +14 -8
  4. package/dist/assets/{index-Kotmn42s.js → index-BcuycrLl.js} +1 -1
  5. package/dist/assets/{index-BLM-0yG6.js → index-CxNvtrVy.js} +1 -1
  6. package/dist/assets/{index-D4P4hbvc.js → index-DHztibvv.js} +1 -1
  7. package/dist/assets/index-Dm6VCxBu.js +186 -0
  8. package/dist/assets/index-ZvQzUBK1.css +1 -0
  9. package/dist/assets/katagami-sans-DMv8PCo8.woff2 +0 -0
  10. package/dist/assets/licenses/hugeicons.txt +21 -0
  11. package/dist/assets/licenses/katagami.txt +93 -0
  12. package/dist/assets/public-viewer-B3t-LR4T.js +24 -0
  13. package/dist/assets/public-viewer-CyDoUT6s.css +1 -0
  14. package/dist/assets/scene-CnihjOu5.js +248 -0
  15. package/dist/assets/share-BWJVjZdG.js +7 -0
  16. package/dist/assets/{three-D_1Qt16u.js → three-DDiuFd7k.js} +21 -21
  17. package/dist/assets/{worker-C10U_apJ.js → worker-B9mWJfQ6.js} +1 -1
  18. package/dist/index.html +2 -2
  19. package/dist-server/cli.mjs +48514 -15784
  20. package/dist-server/install-cli.mjs +204 -0
  21. package/dist-server/server.mjs +1196 -424
  22. package/docs/cli.md +293 -190
  23. package/docs/guide.md +15 -8
  24. package/docs/import-coverage.md +73 -5
  25. package/docs/performance.md +164 -0
  26. package/docs/releases.md +6 -0
  27. package/package.json +18 -10
  28. package/dist/assets/external-links-BmBkCsrt.js +0 -1
  29. package/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  30. package/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  31. package/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  32. package/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  33. package/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  34. package/dist/assets/index-B1kyvo41.js +0 -175
  35. package/dist/assets/index-Du0_nVjH.css +0 -1
  36. package/dist/assets/publishing-CEvQPkO1.css +0 -1
  37. package/dist/assets/publishing-D9CqkbeB.js +0 -23
  38. package/dist/assets/scene-CTHyYtma.js +0 -139
  39. package/dist/assets/share-Cw1E-ED9.js +0 -7
  40. package/docs/importer-comparison.md +0 -48
  41. package/docs/session-artifacts-audit.md +0 -176
@@ -1,48 +0,0 @@
1
- # History importer comparison
2
-
3
- Reviewed November 6, 2026. These are source-code comparisons, not claims that another project's entire importer is correct. References are pinned so later upstream changes do not alter the evidence.
4
-
5
- ## CASS / Franken Agent Detection
6
-
7
- [CASS](https://github.com/Dicklesworthstone/coding_agent_session_search/tree/298f51895585ab086d8b129b9a475a3b26609407) delegates its core connectors to [Franken Agent Detection at `6b337ba`](https://github.com/Dicklesworthstone/franken_agent_detection/tree/6b337ba434b72c65c6c5a748b7ec47885f840ac0), pinned in CASS's Cargo manifest.
8
-
9
- - Its [Codex connector](https://github.com/Dicklesworthstone/franken_agent_detection/blob/6b337ba434b72c65c6c5a748b7ec47885f840ac0/src/connectors/codex.rs#L987-L1004) skips injected-context user records when deriving a title. It also tests mirrored `event_msg` / `response_item` prompts so they do not become duplicate messages.
10
- - Its [Cursor connector](https://github.com/Dicklesworthstone/franken_agent_detection/blob/6b337ba434b72c65c6c5a748b7ec47885f840ac0/src/connectors/cursor.rs#L495-L504) excludes NULL-valued Composer marker rows explicitly. A marker is not a corrupt conversation. It deduplicates native session IDs across database representations.
11
- - Its [Hermes connector](https://github.com/Dicklesworthstone/franken_agent_detection/blob/6b337ba434b72c65c6c5a748b7ec47885f840ac0/src/connectors/hermes.rs#L246-L284) reads message content as text rather than guessing JSON from punctuation.
12
-
13
- **Applied here:** source-specific title normalization, NULL-marker filtering, and native-identity deduplication. Our raw histories remain separate from the map's grouping, and unchanged parser revisions are invalidated when decoding changes.
14
-
15
- ## Agent Sessions
16
-
17
- [Agent Sessions at `555fbfd`](https://github.com/jazzyalex/agent-sessions/tree/555fbfddaa286b63cdef2ef13db88cb9cf320d87) is a comparable local history browser.
18
-
19
- - Its [title selection](https://github.com/jazzyalex/agent-sessions/blob/555fbfddaa286b63cdef2ef13db88cb9cf320d87/AgentSessions/Model/Session.swift#L666-L740) prioritizes custom titles and filters harness preambles before falling back to other text.
20
- - Its [Cursor parser](https://github.com/jazzyalex/agent-sessions/blob/555fbfddaa286b63cdef2ef13db88cb9cf320d87/AgentSessions/Services/CursorSessionParser.swift#L48-L58) recognizes error-only `turn_ended` records. Its user-query tag removal does not cover every attachment/web-context envelope encountered in our audit.
21
- - Some of its preamble checks search for phrases anywhere in a message. Those heuristics can also match a legitimate request quoting a prompt or XML example.
22
-
23
- **Applied here:** retain native Codex names before prompt fallbacks, preserve Cursor lifecycle errors, and normalize only recognized leading context. Strip context before payload truncation so a long injected preamble cannot consume the real prompt's entire budget. Keep literal markup inside user queries intact. Context-only blocks remain source events rather than user-message dots.
24
-
25
- ## Hermes's native writer is the content-format authority
26
-
27
- Hermes [encodes and decodes structured content](https://github.com/NousResearch/hermes-agent/blob/90d6b98fd86d20981ee06ddd5b7d93e4320f26a4/hermes_state_messages.py#L139-L169) using a reserved NUL + `json:` prefix. Ordinary strings are unchanged, even if they are valid JSON. Literal strings starting with the reserved prefix are JSON-string-escaped. Malformed marked content falls back to its original text.
28
-
29
- **Applied here:** follow that contract exactly. Do not parse `[IMPORTANT: ...]`, JSON followed by prose, or a literal JSON example as structured conversation blocks. This fixes whole-session rejection without discarding the offending message. Empty native sessions are reported separately from unreadable histories.
30
-
31
- ## Tokscale
32
-
33
- [Tokscale at `82613d2`](https://github.com/junhoyeo/tokscale/tree/82613d2f5e96654ce3729892afbb0025979f1c75) remains useful for format discovery, native IDs, and archived rollout coverage. Its [Codex parser](https://github.com/junhoyeo/tokscale/blob/82613d2f5e96654ce3729892afbb0025979f1c75/crates/tokscale-core/src/sessions/codex.rs) derives deduplication identity from in-file session metadata. Its [Hermes parser](https://github.com/junhoyeo/tokscale/blob/82613d2f5e96654ce3729892afbb0025979f1c75/crates/tokscale-core/src/sessions/hermes.rs#L1-L19) primarily reconstructs usage from session aggregates and logged API calls.
34
-
35
- **Boundary:** usage aggregates and billing deduplication are not conversation reconstruction. SessionGraph imports recorded messages and times rather than manufacturing turns or allocating aggregate usage to prompts.
36
-
37
- ## T3 / provider overlap
38
-
39
- The inspected connectors do not establish a reusable T3-to-provider ownership rule. SessionGraph uses T3's explicit, strong provider bindings. Matching titles, timestamps, or similar messages never establish identity.
40
-
41
- - A uniquely bound T3 thread with imported user messages occupies one map entry, even when attachment or payload omissions make it partial.
42
- - The inspector offers the separately saved provider history. Grouping does not overwrite, append, or merge the two transcripts, and partial coverage remains visible.
43
- - Empty or pending T3 histories do not hide native sessions. All binding claimants count when checking ambiguity, including pending or partial ones.
44
- - Snapshot changes during T3 discovery get up to three fresh-copy attempts. Only the consistency-race error is retried; schema errors still surface. Paged reads remain pinned to one verified snapshot.
45
-
46
- ## Remaining format boundaries
47
-
48
- Attachments and checkpoint snapshots are still not imported by T3. Cursor Composer values above the existing 32 MB limit are still bounded and reported; NULL markers are excluded from that warning. Native histories that are genuinely empty cannot supply conversation messages. Live validation covers installed sources; fixture tests cover parser families for unavailable harnesses.
@@ -1,176 +0,0 @@
1
- # Session-linked commits, files, branches, and directories
2
-
3
- Investigation: November 6, 2026. Implementation update: November 8, 2026.
4
-
5
- ## Implemented first version
6
-
7
- The approved lean design is now implemented in source: existing sessions and tool events, one `session_commits` table, and small per-session extraction metadata. Execution cwd/exit codes and conditional Claude native Git results are retained; conservative creation/amendment/cherry-pick extraction runs atomically during import. Indexed API/CLI reads, selected-session graph markers, and evidence inspection are available. See the [guide](guide.md#recorded-commit-history) and [harness data matrix](import-coverage.md#imported-data-by-harness) for actual supported behavior.
8
-
9
- The broad multi-table design below is **historical and superseded for this feature**. Separate repository, payload, branch, location, file-summary, and checkpoint indices remain proposals. Provider histories keep their own commit attribution; they are not automatically aggregated. Full local Git enrichment and arbitrary-shell parsing are not implemented. The contract-supported Claude native-result path has fixture coverage; the original live-sample limitation still applies.
10
-
11
- <details>
12
- <summary>Original investigation and broader proposal (historical)</summary>
13
-
14
- ## Conclusion
15
-
16
- Normalize evidence once during import, then serve indexed session-to-artifact links to the graph. We already read changed histories during import; rendering should never need another conversation scan to discover commits or files.
17
-
18
- There is no universal source-provided `session.commits` or complete audit log of everything a session changed. Several sources provide strong structured evidence, and others provide matching tool executions/results from which particular operations can be extracted. Keep the relationship and its evidence explicit: **created a commit**, **started at a commit**, and **mentioned a commit** are different facts.
19
-
20
- Likewise, a workspace snapshot establishes a change during an interval, not exclusive authorship when another agent or person shares that workspace. "Recorded changes" is supportable; "every change made by this agent" is generally not.
21
-
22
- ## What the current app stores
23
-
24
- - [`Session`](../packages/core/src/types.ts) contains native identity, one directory/project, explicit lineage/provider links, timing, and available model/usage metadata. There are no normalized commits, Git branches, repository identities, or directory histories.
25
- - [`ImportedMessage`](../server/adapters/types.ts) contains per-message file evidence, tool names, and structured timeline events. File evidence currently stores only `path`, evidence category, and `steps`; it loses change kind, rename pairing, and line statistics.
26
- - [`SessionGraphStore.detail()`](../server/store.ts) reparses 120 saved message JSON objects per request and aggregates their files/tools. [`loadFiles()`](../src/main.ts) requests every page when selecting a session. This is the scan that a materialized index should replace.
27
- - [`timeline_items`](../server/event-store.ts) already indexes event identity, time, kind, and tool-call correlation, but commits/branches/locations are not extracted into queryable records.
28
- - OpenCode's [`summarizeMessages()`](../server/opencode.ts) recognizes directory moves, but [`opencodeAdapter.read()`](../server/adapters/opencode.ts) does not carry its `locations` into imported messages. The saved detail endpoint always returns `locations: []`. Some move payloads survive as generic event text instead.
29
- - [`Importer`](../server/importer.ts) already skips unchanged source revisions and replaces a session's messages/events in one transaction. This is the natural integration point for artifact extraction and replacement.
30
-
31
- ## Source findings
32
-
33
- "Available" below means observed in the audited source format or specified by its inspected contract. It does not promise that older versions or every session populated the field. Source-specific execution parsing is a potential extension unless explicitly described as imported today.
34
-
35
- | Source | Commit evidence | File evidence | Branch/repository/directory evidence |
36
- | --- | --- | --- | --- |
37
- | **OpenCode V2** | No created-commit collection in the inspected session API. Shell input/result, call ID, completion time, and shell result metadata can support extraction. | Imported `snapshot.files`, with start/end snapshot coverage, or successful edit tools when complete snapshots are absent. | Session `location.directory`, project canonical directory/sandboxes, and recorded `location-switched` messages. VCS endpoints expose location state, not historical session branch ownership. |
38
- | **Claude Code** | Installed SDK declares structured `BashOutput.gitOperation.commit` with SHA, kind, and optional branch. This is an especially useful native path when producers persist it. Otherwise correlate Bash calls/results. | Imported successful Edit/Write/MultiEdit/NotebookEdit results. Raw `file-history-snapshot` records also exist, but their backup semantics need separate validation before using them as a changed-file list. | SDK session metadata has `gitBranch`; raw transcript envelopes have `cwd` and `gitBranch`. These fields can provide recorded observations, rather than a complete branch-switch ledger. |
39
- | **Codex** | Optional `session_meta.payload.git.commit_hash` is a context/base commit, **not a created commit**. Completed command output can support operation extraction. | Imported successful `patch_apply_end`, completed FileChange items, and explicit moves. | Optional header `git.branch`/`repository_url`, `cwd`, and observed `runtime_workspace_roots`; turn contexts can record later `cwd`. Git header data is currently dropped. |
40
- | **T3 Code V2** | Saved command items contain command input/output, status, native provider identity, and `exitCode`. Actual commit-success output was observed. Checkpoint refs are internal snapshots, not user commits. | Completed actual-path `file_change` items are imported. Separate checkpoint projections also contain `files[]` with path, kind, additions, and deletions; these are currently omitted. OpenCode tool labels such as `patch` are not paths. | Thread `branch`, `worktreePath`, project `workspace_root`; checkpoint scopes also record `cwd`. Branch and checkpoint scope metadata are currently omitted. Strong provider links permit additional native-source evidence. |
41
- | **Hermes** | No dedicated created-commit relation found in the inspected sessions schema/adapter. Retained tool calls/results are candidates for source-specific extraction. | Current adapter does not normalize file changes; successful tool-result decoding would need additional work. | Native sessions table has `cwd`, `git_branch`, `git_repo_root`, and a Git metadata generation. Only `cwd` is currently imported. Git fields are mutable observations, not history. |
42
- | **Cursor** | No normalized commit relation in current readers. Exported calls/results are incomplete and cannot establish a complete commit history. | Current reader intentionally supplies no verified file evidence; requests/attachments are insufficient. | Recorded cwd/workspace metadata, with conservative path matching. No verified native Git-branch history in the audited readers. |
43
- | **GitHub Copilot CLI** | Correlated execution start/complete events offer a possible extraction path; no created-commit collection in our reader. | Explicit result `fileEdits[]` is already imported, including changes that succeeded within a partially failed operation. "Committed" here means applied file mutations, not Git commits. | Recorded session-start context cwd; other Git metadata needs format validation before promising support. |
44
- | **GitHub Copilot Chat** | Saved tool invocations/results may permit extraction where full output and execution context survive. | Explicit accepted-edit events are imported. References, proposals, and undo events are not accepted changes. | Explicit working directory or a verified single-folder workspace. Multi-root/remote folders must not be guessed. |
45
- | **Gemini / Qwen** | Correlated recorded tool executions can support extraction; no dedicated commit collection currently imported. | Successful matching edit results already imported. | Gemini project-root marker; Qwen recorded cwd. No verified Git-branch ledger in the audited readers. |
46
- | **Pi and Pi-format sources** | Tool calls/results can support extraction where status and output are retained. | Pi-format parser extracts successful write/edit evidence, including when used by additional harness adapters. | Header cwd. Conversation-tree branches and `branch_summary` are **not Git branches**. |
47
- | **Cline / Roo / Kilo extension** | Potential from structured calls/results; coverage is limited by retained API-conversation snapshots. | Matching successful edit tools where recorded. XML requests alone are insufficient. | Matching task/session metadata supplies workspace and explicit lineage. Checkpoint/branch semantics outside current readers need validation. |
48
- | **Continue** | Potential from retained execution results; no dedicated commit index. | Current reader does not extract verified edits. | `workspaceDirectory`; no verified Git history in the current reader. |
49
- | **Other conversation adapters** | No native commit index implemented. Validate each producer's execution/result format before enabling extraction. | Mostly message-oriented readers; do not infer support merely because tool text exists. | Selected cwd/working-directory/folder fields where explicitly available; missing paths remain unknown. |
50
- | **Metadata-only / detection-only sources** | Insufficient evidence for session-created commits. | Insufficient change evidence. | Some expose native session/workspace identity; detection-only inputs create no sessions. |
51
-
52
- The additional conversation adapters include Amp, Droid, Codebuff/Freebuff, Kimi, Grok, Jcode, Cherry Studio, Command Code, ZCode, CodeBuddy, WorkBuddy, Proma, DeepSeek Harness, Aside, Vibe, Goose, Zed, Devin, Crush, Octofriend, Kilo CLI, MiMo, Unsloth, Kiro, Mux, and captured MiniMax histories. OpenClaw varies by representation: the database reader is message-oriented, while its Pi-format export reader can extract successful edits. See [extended import coverage](import-coverage.md) for the complete registry and format limitations. These sources were reviewed at the adapter/format level, not all against live installations.
53
-
54
- ### Particularly useful data we currently discard
55
-
56
- **T3 checkpoints.** The inspected SQLite schema has `orchestration_v2_projection_checkpoints`, linked by thread/scope/run/node, with status and capture time. Ready checkpoints with nonempty file lists were observed. `orchestration_v2_projection_checkpoint_scopes` supplies cwd. Checkpoint activity items carry `checkpointId`, `scopeId`, and files as well: consume one authoritative representation and deduplicate by checkpoint ID. Validate the interval/baseline before summing line changes. Empty lists on unavailable/missing checkpoints are not proof of no edits. Refs under `refs/t3/orchestration-v2/checkpoints/...` must remain a separate checkpoint category even when backed by Git commit objects.
57
-
58
- **T3 commands.** The adapter currently preserves input/output but drops `exitCode` and, for ordinary commands, native call identity. Preserve both before extracting operations. The command projection can omit the provider's per-call cwd, so use scoped directory evidence or the linked provider record when necessary; do not blindly attach every operation to the thread's latest directory.
59
-
60
- **Claude native Git results.** SDK `0.3.312` / Claude Code `2.1.312` declares:
61
-
62
- ```ts
63
- gitOperation?: {
64
- commit?: { sha: string; kind: 'committed' | 'amended' | 'cherry-picked'; branch?: string };
65
- push?: { branch: string };
66
- branch?: { ref: string; action: 'merged' | 'rebased' };
67
- pr?: { number: number; url?: string; action: string };
68
- }
69
- ```
70
-
71
- The live SDK user-message envelope exposes `tool_use_result`; on-disk producers can use a different envelope spelling that must be checked. The narrower `getSessionMessages()` return type does not expose structured tool output or Git metadata. Our transcript loader already reads raw entries before using the SDK conversation-chain parser, so an enrichment pass can join retained entries to returned message UUIDs without flattening away those fields or including abandoned conversation branches accidentally. The small surviving local Claude sample confirmed `cwd`, `gitBranch`, and file-history records, **not an actual `gitOperation` result**. Treat Git-operation persistence as contract-supported and requiring a producer-specific fixture/live example before shipping.
72
-
73
- **Codex metadata.** Sampled rollouts confirmed optional `git.commit_hash`, `git.branch`, and `git.repository_url`. Other sampled headers lacked Git metadata. Preserve them as observations attached to the header, with their recorded timing; never count the initial SHA as a session-created commit.
74
-
75
- **Hermes Git fields.** The installed writer updates cwd and Git metadata together, with generation checks for asynchronous probes. It may retain a previous nonempty Git value when a same-cwd probe fails. Store this as the harness's recorded metadata observation, not an exact historical checkout event or current disk truth.
76
-
77
- **OpenCode execution metadata.** The local API exposed completed shell `state.metadata.exit`, `status`, and `truncated`. Our generic timeline conversion retains content but drops this metadata. A completed tool envelope alone is insufficient to prove a successful Git command. The V2 API also exposes session snapshot diffs and durable logs; neither is a native list of commits created by a session. `revert/commit` applies a staged session revert, not a Git commit operation.
78
-
79
- ## Reliability rules
80
-
81
- ### Commits
82
-
83
- Accept a created-commit link from a validated native operation result, or a correlated Git execution with a confirmed commit outcome and unambiguous repository context. Keep extraction provenance so users can inspect the evidence.
84
-
85
- - Prefer native structured results. Fallback parsers should understand a small set of execution formats and actual command syntax, not search arbitrary prose for hexadecimal strings or `git commit`.
86
- - A successful command request, "I committed it," a `git log` listing, an initial HEAD, or matching timestamps does not establish creation.
87
- - Preserve full object IDs when available. Resolve abbreviated IDs only against the identified local repository and require an unambiguous commit object. Keep unresolved evidence explicit; do not invent the remaining hash.
88
- - Optional read-only Git enrichment can fetch subject, parents, object format, and commit dates in batches after attribution. It validates/enriches the object; it does not establish which session created it. Do not fetch repositories or inspect every repository's full log per session.
89
- - A shell command can create a commit and then fail during push/test. Conversely, `git commit ...; echo done` can return zero after commit failure. Overall exit status is not enough: attribute the specific operation. Background execution requires its eventual result.
90
- - Distinguish creation, amendment, cherry-pick, merge/rebase effects, push, base/checkout observation, and reference. A pushed commit need not have been created in that session.
91
- - Use recorded execution time for a graph action marker. Git author/committer dates are separate and may be rewritten or backdated.
92
- - Exclude harness checkpoint refs from normal commit markers. Copied/inherited history in a fork does not mean the child created the parent's commits.
93
-
94
- ### Files
95
-
96
- Accept actual source snapshots/file-change records and confirmed successful edit results. Preserve whether the evidence is a workspace delta or an agent tool mutation.
97
-
98
- - A file read, mention, proposed patch, attachment, or tool name is not a change.
99
- - Snapshot coverage can miss files excluded by the source, transient edits reverted within one interval, or changes outside its workspace. Edit tools can miss shell scripts, generators, formatters, and external changes. The union is useful, but still has a coverage boundary.
100
- - Paths require source-specific resolution: snapshot-relative paths, per-call cwd, and session cwd are not interchangeable. Preserve original path and resolution base; do not resolve old relative paths against the session's latest directory.
101
- - Keep rename source/destination and operation type when explicitly recorded. A filename is not a stable identity across renames.
102
- - `steps` currently counts recorded evidence steps, not lines or unique tool invocations. Do not double-count matching snapshot and tool evidence. Snapshot line deltas over overlapping intervals cannot be summed as net session changes.
103
-
104
- ### Branches, repositories, and directories
105
-
106
- Define "touched" explicitly rather than using one undifferentiated string list:
107
-
108
- - Branch: `observed`, `created`, `checked_out`, `merged`, `rebased`, or `pushed`.
109
- - Directory: `session_workspace`, `execution_cwd`, `workspace_move`, or `modified_file_parent`.
110
- - Repository: observed native metadata or a verified local repository/worktree association.
111
-
112
- Starting/last-recorded branch fields do not enumerate every intermediate branch. Working in a file's parent directory is different from running a command there. `cd` in a command may be subshell-local; `git -C`, explicit workdir, worktree moves, remote execution, and multi-repository commands need their own context. Worktree directory names must never be decoded into guessed branch names. Git's current branch and reflog alone cannot reconstruct session attribution.
113
-
114
- ## Proposed normalized model
115
-
116
- Use ordinary relational links with `session_id` foreign keys, backed by a compact summary on the existing session object. The following are conceptual tables, not a migration:
117
-
118
- | Record | Important fields |
119
- | --- | --- |
120
- | `repositories` | Local repository identity, object format, verified common Git directory when available; retain observed roots/aliases separately. Remote URL alone is not unique. |
121
- | `commits` | Repository ID + full object ID; optional subject, parents, author/committer dates. |
122
- | `session_commits` | Session ID, commit ID, relationship, recorded action time, evidence reference. |
123
- | `session_files` | Session ID, repository/workspace scope, resolved or explicitly unresolved path, observed-change summary, evidence coverage. |
124
- | `session_branches` | Session ID, repository/workspace scope, branch/ref, relationship, recorded observation/action time. |
125
- | `session_locations` | Session ID, directory/worktree, relationship, recorded time and source order. |
126
- | `session_checkpoints` | Session ID, native checkpoint ID/ref, scope/baseline, capture time/status; file deltas kept separate from Git commits. |
127
- | `artifact_evidence` | Owning source/native session, native message/event/call/checkpoint ID, extraction version, status, evidence kind, time provenance, source revision. |
128
- | `session_artifact_summary` | Indexed counts, per-category coverage, artifact revision, bounded marker summary if needed. |
129
-
130
- Keep the action/evidence rows as well as unique artifact links: one commit can have multiple recorded operations or sources; multiple sessions may contribute to a file or refer to a commit. Do not use a global SHA or path alone to collapse repository/workspace identity. Unknown repository scope should remain distinct until a verified association exists.
131
-
132
- Index by `(session_id, ...)`, by `(session_id, occurred_at)`, and by repository/object ID. A time-first marker index can support graph-wide date windows. Store `occurred_at = NULL` when absent; source order remains available without invented marker positions.
133
-
134
- Per-category coverage should include support, extraction completion, revision/version, missing/truncated input, and the evidence scope. "Finished extracting observed edits" is not "proved that all filesystem edits were captured." Unknown is not zero; counts should mean **recorded/confirmed items**, with coverage attached. A single `capabilities.files` boolean or conversation `coverage.history` flag cannot express this.
135
-
136
- ### Import and invalidation
137
-
138
- 1. Read session-level metadata directly during discovery where available.
139
- 2. Extract native artifact facts from raw records while the adapter already reads history, before text/payload truncation discards structured fields. Bound artifact extraction independently and disclose limits.
140
- 3. Correlate tool requests/results across pages by native call identity and session scope. Do not rely on a one-message overlap for nonadjacent or parallel calls. Preserve source order and handle duplicate/inherited records explicitly.
141
- 4. Normalize and deduplicate facts, then atomically replace artifact links, evidence, summary, messages, events, and search invalidation in the existing snapshot transaction. Failed refreshes retain the previous saved artifact snapshot.
142
- 5. Track an artifact extractor version separately from source revision. An unchanged source still needs reprocessing after extractor changes. Include newly consumed checkpoint/metadata dependencies in revision calculation.
143
- 6. Backfill from saved structured events/files when sufficient. Fields already discarded, including native checkpoint lists and structured tool metadata, require source refresh. An unavailable source stays unavailable rather than becoming an empty list.
144
- 7. For T3, aggregate evidence from explicitly and unambiguously linked provider sessions. Retain original ownership and native call IDs, deduplicate mirrors, and invalidate the visible T3 summary when a linked provider revision changes. Ambiguous links must not merge unrelated evidence.
145
-
146
- ### Fast graph reads
147
-
148
- - Keep the graph's session payload small: counts, coverage, revision, and optionally a small bounded marker preview. Do not attach every file path and full commit body to every session in the initial graph response.
149
- - Fetch lightweight commit markers for visible session IDs/time windows in bounded batches. Include only IDs, session links, action times, and display data. Query normalized artifact indexes, never message JSON. Cache against artifact revision.
150
- - Use clustering/level of detail and explicit result limits for large graphs; omitted markers must be distinguishable from missing source data. Untimed commits remain in the inspector instead of being placed at fabricated times.
151
- - Lazy-load a selected session's full artifacts and evidence from the same indexes. Existing file-detail routes can retain their public shape while changing their backing query from message scans to indexed file summaries.
152
- - Optional Git enrichment is cached by repository/object ID and occurs outside the rendering path. It should not delay showing already-confirmed session evidence.
153
-
154
- ## Other useful session-linked facts
155
-
156
- Native session identity, explicit forks/children/provider bindings, recorded message times, tool calls/results and statuses, model/provider observations, and available token/cost totals can use the same provenance conventions. T3 also records linked/branch PR references, and Claude's SDK declares PR operations. A linked PR is an association; an explicit created/merged operation is an action. Token usage, model metadata, and lineage still have source-specific coverage, and T3/provider mirrors must not double-count them.
157
-
158
- ## Recommended order
159
-
160
- 1. Materialize currently imported file/tool evidence and add per-category coverage. Preserve OpenCode directory moves and the verified branch/repository metadata from Claude, Codex, T3, and Hermes.
161
- 2. Add T3 ready-checkpoint file evidence, preserving scope/baseline and keeping internal checkpoints distinct from commits.
162
- 3. Add commit evidence extraction: validated Claude native results when present, then conservative OpenCode/T3/Codex execution parsers with repository context and success checks.
163
- 4. Render lightweight commit markers and indexed artifact details. Expand other sources only as their native result formats are verified.
164
-
165
- Meaningful implementation checks should cover failed/dry-run/multi-command commits, successful commit followed by failed push, short-hash ambiguity, internal checkpoints, branch moves, relative paths across workspaces, fork-inherited history, duplicate T3/provider evidence, page-boundary correlation, unavailable sources, truncation, and atomic replacement. Verify graph reads do not query `messages` or parse timeline payloads after indexing.
166
-
167
- ## Evidence and scope of this audit
168
-
169
- - Reviewed all registered adapter families, current storage/import code, timeline indexes, and the file-detail loading path.
170
- - Inspected T3 and Hermes native schemas through private read-only SQLite copies, including T3 ready checkpoint file shapes and successful/failed command result shapes.
171
- - Inspected bounded local Codex and Claude transcript samples. Some saved transcript paths no longer existed; the surviving Claude sample was small. These samples establish field presence, not population-wide completeness.
172
- - Used OpenCode's authenticated loopback GET API for its live OpenAPI schema, session/message shapes, shell result metadata, and snapshot shapes. No OpenCode database access or agent execution was used. Public contract: [OpenCode V2 API](https://opencode.ai/v2/docs/api).
173
- - Inspected the installed Claude SDK's `sdk-tools.d.ts` (`BashOutput.gitOperation`), `sdk.d.ts` (`SDKSessionInfo`, `SDKUserMessage`, `SessionMessage`), and installed Hermes metadata writer semantics.
174
- - Diagnostics and local field-shape reports are in ignored `tmp/audit-session-evidence*`. The investigation did not import into or rewrite the persistent SessionGraph library. No runtime behavior or artifact index was implemented.
175
-
176
- </details>