Cognitive Atoms — VS Code extension
Capture coding cognition — the decisions and the why behind your code —
into your local Cognitive Atoms Continuity Graph, from inside the editor.
This is the #2 capture surface in the plugin adoption strategy
(docs/gtm/PLUGIN_ADOPTION_STRATEGY.md, P1): the editor is where builders do
their hardest reasoning, and the "why" behind code is the single most painful
thing that evaporates when you reopen a repo cold. It reuses the exact same
normalized capture contract as the browser extension, so VS Code captures flow
through the identical local ingestion pipeline — provenance is the only thing
that differs.
Status: built, not published. Marketplace / Open-VSX publishing is a
Founder-GO decision (ACTIVE_OPERATING_MODEL.md §3 / strategy §3). The
publisher field is a placeholder. Nothing here lists or ships itself.
What it captures
Six commands (Command Palette + editor right-click on a selection):
| Command |
Cue prefixed (matches capture_core.js) |
capture_kind |
Cognitive Atoms: Capture Decision |
Decision: |
mark:decision |
Cognitive Atoms: Capture Open Question |
Open question: |
mark:open_question |
Cognitive Atoms: Capture Selection as Reasoning |
Architecture note: |
mark:rationale |
Cognitive Atoms: Capture Risk / Blocker |
Risk: |
mark:blocker |
Cognitive Atoms: Capture Roadmap / Task |
Roadmap: |
mark:task |
Cognitive Atoms: Check Runtime Connection |
— |
(health probe) |
Each command captures the current selection (or, if there is no selection,
a note you type). The cue word is prefixed to the body so the existing
server-side cognition_engine detection rules classify it — no special backend
channel.
Payload parity with the browser extension
The payload is produced by src/capture.ts, a faithful TypeScript port of
apps/browser_extension/capture_core.js. Same shape, same cues, same rules:
{
"source_type": "VSCODE_BROWSER_EXTENSION", // configurable rail (provenance only)
"provider": "VSCODE",
"provider_hint": "VSCODE",
"url": "",
"title": "myrepo — src/net.ts", // provenance, not code
"captured_at": "2026-06-06T00:00:00.000Z",
"capture_kind": "mark:decision", // "mark:<intent>" | "selection"
"capture_intent": "decision",
"messages": [
{ "index": 0, "role": "user",
"text": "Decision: retry with backoff\n\nNote: thundering herd otherwise",
"source_selector": "src/net.ts:5-9" } // file + line range, never the code body
]
}
Why the *_BROWSER_EXTENSION rail? The runtime accepts a pre-structured
messages[] payload only on the *_BROWSER_EXTENSION rails (see backend
app.py). The CLAUDE_CODE_SESSION rail — the natural coding rail — requires a
.jsonl transcript file on disk, not a live note, so it can't carry an
in-editor capture. We therefore ride a *_BROWSER_EXTENSION rail. As of
VSCODE-EXT-001 there is a first-class VSCODE_BROWSER_EXTENSION source type
(provider VSCODE) so in-editor captures self-identify honestly instead of
borrowing CLAUDE_BROWSER_EXTENSION; it is the default, configurable via
cognitiveAtoms.sourceType. Provider is provenance only; every rail flows
through the same pipeline (deterministic AtomIDs, secret redaction).
Transport (local-only, honest offline)
src/transport.ts is the sole network actor — the editor analogue of the
browser extension's service_worker.js:
- Probe
GET <backendUrl>/health.
POST <backendUrl>/ingestion/preview (dry run).
POST <backendUrl>/ingestion/commit with { project_id, redact_secrets: true }.
A loopback-only guard refuses any non-loopback base URL before any request
— nothing can leave the machine. When the runtime is offline the capture is
not saved and you get a calm warning ("Your capture was NOT saved…") —
never a fabricated success.
Privacy — mirror-never-infer
- Every capture is explicitly user-invoked via a command. No listeners, no
auto-capture, no polling, no file scraping, no telemetry.
- Only the text you select or type is captured. The file path + line
range are attached as provenance, never the surrounding code body. Set
cognitiveAtoms.includeFileContext: false to omit even that.
- Network is loopback-only; no cloud relay.
Settings
| Setting |
Default |
Purpose |
cognitiveAtoms.backendUrl |
http://127.0.0.1:8765 |
Local runtime base URL (loopback only). |
cognitiveAtoms.projectId |
Cognitive Atoms |
Project committed captures file under. |
cognitiveAtoms.sourceType |
VSCODE_BROWSER_EXTENSION |
Provenance rail (see above). |
cognitiveAtoms.includeFileContext |
true |
Attach file/line provenance (never code). |
A status-bar item shows connected / offline and re-checks on click.
Build & test
cd apps/vscode_extension
npm install
npm run compile # tsc → out/
npm test # node --test on the compiled pure functions (no VS Code host)
The unit tests cover the pure capture/normalize + transport-guard logic and
run under plain Node — no VS Code Extension Host required. Driving the actual
commands / status bar needs the VS Code host (@vscode/test-electron), which is
left for a host-equipped environment.