v1.1.1VS Code · Cursor · CLI · MCP
Explain a line of code without touching the code.
Comments live in a .comment file beside your source. They show up on the line in your editor, follow it as the code moves, and can be read by AI agents.
code --install-extension zainzafar90.comment-sidecar// how it works
Your source stays clean.
Every source file can have one sidecar: app.tsx gets app.tsx.comment. It holds each comment’s line number and fingerprints, never your code, so the source and its diffs stay exactly as they were.
The sidecar sits under its file in the Explorer. Commit it with your code: it’s plain text, so it goes through branches and code review like everything else.
- src
- app.tsx
- app.tsx.comment
- main.tsx
- session.ts
- package.json
- 1HeaderFormat version and file names.
- 2Which lineThe line number, a stable ID and the state.
- 3FingerprintsHashes of the line and its neighbors. Never a copy of your code.
- 4Your commentPlain text. Multi-line comments work too.
// tracking
Comments keep up.
When the source changes, the fingerprints decide where each comment belongs now. A comment that can’t be placed with confidence tells you so instead of guessing.
Fix a flagged comment with Mark Comment Reviewed or Reattach Comment to This Line. Renaming a file in the editor renames its sidecar too.
| Attached | The line is where it was. | comment! |
|---|---|---|
| Moved | Code was added or removed above it, and it followed. | comment! |
| Needs review | The line itself was edited, or only the line still matches. | comment! |
| Ambiguous | Several lines match, so it won't pick one. | warning, no marker |
| Detached | The line was deleted, split or rewritten. | warning, no marker |
// for agents
Readable by agents.
Agents don’t see editor decorations. The CLI and the MCP server give them the code and its comments in one read, with the original line numbers.
- Instructions
- Run Copy Agent Instructions and paste the result into
AGENTS.mdor a Cursor rule. - MCP server
- Run Copy Cursor MCP Configuration and merge it into
.cursor/mcp.json.
Comment text reaches the agent as untrusted data, never as instructions. Writing is opt-in and only touches .comment files.
comment_sidecar_readSource and comments togethercomment_sidecar_checkComments that need attentioncomment_sidecar_writeOpt-in. Edits .comment files only
// install
Try it on your code.
Free and MIT licensed. Works in VS Code 1.85 or later, Cursor and other editors built on VS Code. Nothing leaves your machine.
code --install-extension zainzafar90.comment-sidecarOr install Comment Sidecar from the Marketplace. Then put the cursor on a line and press Ctrl Alt ; (Cmd Alt ; on macOS).
- In Cursor, open Extensions and search for Comment Sidecar. It comes from Open VSX, which VSCodium uses too.
- Install it, then put the cursor on a line and press Ctrl Alt ; (Cmd Alt ; on macOS).
{ "mcpServers": { "comment-sidecar": { "type": "stdio", "command": "node", "args": [ "~/.cursor/extensions/zainzafar90.comment-sidecar-1.1.1/src/mcp.js", "--root", "/path/to/your/repo" ] } } }
Run Copy Cursor MCP Configuration to get this with your real paths filled in. Choose read and write to add --allow-write. Copy it again after an update.
// questions
Good to know.
- Does it ever change my source files?
- No. Only
.commentfiles are written. A sidecar that can’t be read is reported as an error; it is never treated as empty or overwritten. - Should I commit
.commentfiles? - Yes. They belong with the code they describe, so they travel through branches and code review like everything else.
- Can a comment span several lines?
- A comment attaches to one line: the line that enforces the rule. Its text can run over as many lines as you need, and one line can hold several comments.
- Which languages does it support?
- Any UTF-8 text file. Comments attach to physical lines, so there’s no parser or language server involved.
- Does anything leave my machine?
- No. There is no network access, telemetry or model call. An agent you connect may send tool output to its model; that part is up to the agent.