agentleFS
wictorwilenwictorwilen/MRSF/.github/copilot-instructions.md

MRSF

Copilot instructions30 starsChanged 9 months agoMITView on GitHub

MRSF (Markdown Review Sidecar Format), also known as Sidemark, is a specification plus tooling for storing review comments in sidecar files alongside Markdown documents. The canonical spec is MRSF-v1.0.md. This is a multi-package monorepo with no root package.json. Each package is managed independently: Key dependencies: - @mrsf/mcp depends on @mrsf/cli via file:../cli - @mrsf/markdown-it-mrsf and @mrsf/rehype-mrsf depend on @mrsf/plugin-shared via file:../shared and @mrsf/cli via file:../../cli All commands run from within the respective package directory — there is no root-level build.

The file

We split this copilot-instructions.md into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All commands run from within the respective package directory — there is no root-level build.

    line 27
  2. Very specific:

    When modifying @mrsf/cli, rebuild dependents in order: cli → mcp, plugins/shared → plugins/markdown-it, plugins/rehype.

    line 66
  3. Distinctive:

    When adding or changing sidecar fields, you must update all three of:

    line 70
  4. Very specific:

    ESM only: All packages use "type": "module" with NodeNext module resolution.

    line 82

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions for MRSF

Project Overview

MRSF (Markdown Review Sidecar Format), also known as Sidemark, is a specification plus tooling for storing review comments in sidecar files alongside Markdown documents. The canonical spec is MRSF-v1.0.md.

Repository Architecture

This is a multi-package monorepo with no root package.json. Each package is managed independently:

PackagePathnpm nameBuildPurpose
CLI & librarycli/@mrsf/clitscCore library + CLI binary (mrsf)
MCP servermcp/@mrsf/mcpesbuildModel Context Protocol server for AI agents
Plugin sharedplugins/shared/@mrsf/plugin-sharedtscShared types, comment logic, CSS, and controller for rendering plugins (private)
markdown-it pluginplugins/markdown-it/@mrsf/markdown-it-mrsftscStandalone markdown-it plugin for rendering comments
rehype pluginplugins/rehype/@mrsf/rehype-mrsftscStandalone rehype plugin for rendering comments (unified ecosystem)
VS Code extensionvscode/mrsf-vscodeesbuildEditor integration (marketplace: wictor.mrsf-vscode)
Documentationdocs/(private)VitePressSite deployed to Azure Static Web Apps

Key dependencies:

  • @mrsf/mcp depends on @mrsf/cli via file:../cli
  • @mrsf/markdown-it-mrsf and @mrsf/rehype-mrsf depend on @mrsf/plugin-shared via file:../shared and @mrsf/cli via file:../../cli

Build, Test, and Lint

All commands run from within the respective package directory — there is no root-level build.

TypeScript packages (cli/, mcp/, vscode/, plugins/)

# Build
npm run build

# Run all tests (Vitest)
npm test

# Run a single test file
npx vitest run src/__tests__/reanchor.test.ts

# Run tests matching a pattern
npx vitest run -t "fuzzy match"

# Type-check without emitting
npm run lint

Tests live in src/__tests__/ within each package. Packages with test suites: cli (most comprehensive), mcp, plugins/markdown-it, plugins/rehype. The VS Code extension and plugins/shared have no tests.

Python package (python/)

cd python
source .venv/bin/activate   # uses a local venv

pytest -v                   # run all tests
pytest tests/test_validator.py  # single file
pytest -k "test_reanchor"   # pattern match

ruff check .                # lint
mypy src/                   # type-check (strict)

Build order for cross-package changes

When modifying @mrsf/cli, rebuild dependents in order: cli → mcp, plugins/shared → plugins/markdown-it, plugins/rehype. Plugin builds copy CSS and JS assets from plugins/shared/ into their own dist.

Spec ↔ Schema Sync

When adding or changing sidecar fields, you must update all three of:

  1. MRSF-v1.0.md — the normative specification
  2. mrsf.schema.json — JSON Schema for sidecar files
  3. cli/src/lib/types.ts — TypeScript type definitions

The config schema (mrsf-config.schema.json) is separate and covers .mrsf.yaml configuration files only.

Key Conventions

  • RFC 2119 keywords: The spec uses MUST, SHOULD, MAY (uppercase) as normative requirement levels. Preserve this convention.
  • Field naming: YAML/JSON sidecar fields use snake_case (e.g., selected_text, end_line). TypeScript interfaces mirror the snake_case field names for serialization fidelity, while internal function/method names use camelCase.
  • ESM only: All packages use "type": "module" with NodeNext module resolution. Use .js extensions in TypeScript import paths.
  • Strict TypeScript: strict: true in all tsconfig files. Target is ES2022.
  • Sidecar discovery: Sidecar files are named <document>.review.yaml (or .review.json), co-located by default. Alternate locations via .mrsf.yaml config with sidecar_root.
  • Plugin parity is mandatory: All rendering plugins MUST preserve the same look and feel, the same comment/gutter/inline rendering logic, and the same end-user functionality unless a package is explicitly documented as editor-only behavior. Shared rendering behavior, styling, and interaction rules should live in shared code rather than being reimplemented divergently per plugin.
  • Editor integrations extend parity, not replace it: Interactive editors such as Tiptap may add live editing and sidecar-maintenance behavior, but their rendered gutters, inline highlights, line highlighting, tooltip behavior, and thread semantics SHOULD match the static rendering plugins as closely as the host DOM allows.

CLI Library Exports

The @mrsf/cli package exports both the CLI binary and a programmatic API. The MCP server consumes the library API directly — functions like discoverSidecar, parseSidecar, validate, reanchorDocument, addComment, etc. are all imported from @mrsf/cli into the MCP server. When modifying library functions, check for MCP server usage.

Code Patterns

  • Graceful git degradation: Git operations return null when git is unavailable rather than throwing. Git availability is cached. All git calls use execFile (no shell) with a 10-second timeout.
  • Config discovery: .mrsf.yaml is found by walking up the directory tree toward the git root. The sidecar_root config value rejects absolute paths and .. traversal for safety.
  • Schema validation: Uses ajv (TypeScript) / jsonschema (Python). Schemas are loaded once and cached globally. The CLI resolves the schema path from multiple fallback locations (dist, dev, cwd).
  • Test fixtures: Tests use inline helper functions (makeDoc, makeComment) rather than external fixture files. Temp directories are created in beforeEach and cleaned up in afterEach. Path assertions use regex to handle OS differences: expect(result).toMatch(/docs[/\\]guide/).

Python Package

The python/ package is a 1:1 port of the Node.js CLI with identical module structure (validator.py ↔ validator.ts, discovery.py ↔ discovery.ts, etc.) and the same test cases. Uses ruamel.yaml for round-trip YAML preservation with yaml.indent(mapping=2, sequence=4, offset=2) to match MRSF sidecar formatting.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.