TrustOps Provenance — VS Code extension (Tier-2 + activity log)
Captures privacy-safe AI-authorship signals and sends them to a TrustOps
server for Tier-2 provenance (ai_authorship_source = "ide_plugin") and a
human-readable activity log.
| Category |
Example |
Sent |
| Session on/off |
extension activated 09:00, telemetry disabled 17:00 |
event type + timestamp + active assistants |
| Active assistants |
"GitHub Copilot, Claude active this session" |
extension names only |
| Modules added |
src/new_module.py added |
path + line count + hash |
| Change descriptors |
src/foo.py L10–L24 written by Claude after prompt about 'adding retry logic'; L18–L20 revised by human |
file + line range + assistant + prompt summary + hash |
| Prompt summaries |
"adding retry logic" |
locally-derived summary + hash + length |
| AI acceptance counts |
15 AI lines in src/foo.py |
counts (feed server Tier-2) |
What is NEVER sent (default)
Source code, code diffs, file contents, and raw prompt text. Prompts are
reduced to a short, locally-generated summary + a SHA-256 hash. The server
also rejects any payload carrying raw content (defence in depth).
⚠️ Raw capture (dual opt-in, default OFF)
trustops.rawCaptureEnabled additionally sends raw prompt text + raw code
deltas. It is OFF by default and enabling it shows a modal warning. It only
takes effect if the server ALSO sets IDE_ALLOW_RAW_CAPTURE=true — otherwise
the server rejects the data (HTTP 422). Use only against a self-hosted server
you trust; it breaks the "we never see your code" guarantee.
Consent & auth
- Opt-in only (
trustops.telemetryEnabled, default false; one-time prompt).
- Bearer token on every POST; server also requires its feature flag + a
configured
IDE_INGEST_TOKEN.
How AI vs. human is distinguished (honest heuristic)
No editor exposes an authoritative "this came from AI" event. The extension:
- treats a single edit inserting ≥
trustops.minInsertLines lines as a
candidate AI completion and remembers its line range;
- treats a later edit inside that range as a human-in-the-loop revision;
- attributes an AI completion to the most recent recorded prompt;
- exposes
trustops.recordAICompletion and trustops.recordPrompt so AI tools
or keybindings can report precisely.
The server treats all of this as Tier-2 evidence (a measured %), never ground
truth. Prompt summaries are a local keyword/intent heuristic — a local SLM is the
upgrade path (keeps everything on-device).
Build & run
cd ide/vscode
npm install
npm run compile # tsc -> out/
# Press F5 in VS Code for an Extension Development Host, or package:
npx @vscode/vsce package # -> trustops-provenance-0.2.0.vsix
ingestUrl, ingestToken, assistant, telemetryEnabled, minInsertLines,
promptSummaries (default on), rawCaptureEnabled (default off), repoFullName.
Server must have FEATURE_IDE_PLUGIN_SOURCE_ENABLED=true + matching
IDE_INGEST_TOKEN (and IDE_ALLOW_RAW_CAPTURE=true only if you use raw capture).
⚠️ Open the git repository root as your workspace folder
For Tier-2 provenance to attach to a PR, the file paths the extension reports
must match the paths GitHub's PR files API returns — which are
repo-root-relative (e.g. src/app.py, not app.py or myrepo/src/app.py).
The extension derives each path with path.relative(workspaceFolder, file), so:
- ✅ Open the folder that is the git repo root. Then
src/app.py → src/app.py. Match.
- ❌ Open a parent directory (one that contains the repo in a subfolder). Then
src/app.py → myrepo/src/app.py. The server's join finds no overlap and
provenance stays undetermined.
- ❌ Open a subdirectory of the repo (e.g. a
backend/ package). Then
backend/app.py → app.py. Same mismatch.
Path separators are normalized to / automatically, so Windows backslashes are
not an issue. But the workspace-root = repo-root rule is on you: if your repo
is nested, open it directly (File → Open Folder… on the repo root), or use a
multi-root workspace whose folder boundary is the repo root. Multi-root
workspaces work as long as each folder root is a repo root.
Read it back
GET /reports/ide-activity?repo=org/repo returns the session log, prompt
summaries, active assistants, and the rendered change sentences.