agentleFS
szaffaranoszaffarano/org-mcp-server/.github/copilot-instructions.md

org-mcp-server

Copilot instructions42 starsChanged 5 months agoMITView on GitHub

org-mcp-server is a Rust Model Context Protocol (MCP) server for org-mode knowledge management. It provides search, content access, and note linking capabilities for org-mode files through the MCP protocol. ALWAYS reference these instructions first and fallback to the CLAUDE.md file, search, or bash commands only when you encounter unexpected information that does not match the info here. - NEVER CANCEL builds or tests - they may take up to 90 seconds to complete - Build the workspace: cargo build --…

The file

Show its rules and text

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

35 rules. About 0 are common, 11 are distinctive, and 24 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 24

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Run tests: cargo test -- takes ~2 seconds, 36 tests.

    line 20
  2. Very specific:

    Check formatting: cargo fmt --check -- takes \<1 second.

    line 24
  3. Very specific:

    Run CLI tool: cargo run --bin org-cli -- --help

    line 28
  4. Very specific:

    Run MCP server: cargo run --bin org-mcp-server (needs valid org directory)

    line 29
  5. Very specific:

    Run examples: cargo run --example <name> (examples in org-core/examples/)

    line 30
  6. Very specific:

    Test specific crate: cargo test -p <crate-name>

    line 31
  7. Very specific:

    Build validation: Run cargo build and wait for completion (90+ seconds)

    line 38
  8. Very specific:

    Test validation: Run cargo test and verify all 36 tests pass

    line 40
  9. Distinctive:

    CLI validation: Test core CLI functionality:

    line 42
  10. Very specific:

    Linting validation: Run cargo clippy and cargo fmt --check

    line 51
  11. Distinctive:

    ALWAYS: test the CLI with actual org files after making changes

    line 55
  12. Distinctive:

    ALWAYS: verify that the core functionality works with test fixtures

    line 56
  13. Very specific:

    Use org-core/tests/fixtures/ for testing - contains 8 org files with various structures

    line 57
  14. Very specific:

    Test files include: sample.org, with_ids.org, nested.org, etc.

    line 59
  15. Distinctive:

    Use custom error types with proper chaining

    line 97
  16. Very specific:

    Prefer explicit Result<T, E> over panics

    line 98
  17. Very specific:

    Check org-core/src/error.rs for error definitions

    line 99
  18. Distinctive:

    Always: start by running the full validation suite

    line 105
  19. Very specific:

    Build immediately: after changes: cargo build (wait 90+ seconds)

    line 107
  20. Very specific:

    Test immediately: after changes: cargo test

    line 108
  21. Distinctive:

    Always: run CLI validation scenarios

    line 109
  22. Very specific:

    Always: run cargo clippy and cargo fmt before committing

    line 110
  23. Very specific:

    Use cargo fmt before all commits

    line 114
  24. Very specific:

    Use "string {var}" over "string {}", var

    line 115
  25. Very specific:

    Add #[cfg(test)] modules for tests

    line 117
  26. Very specific:

    Use assert_eq! over assert!

    line 118
  27. Distinctive:

    CRITICAL: Always test with real org files using CLI commands

    line 124
  28. Distinctive:

    Test files contain various org-mode features (headings, IDs, properties)

    line 125
  29. Very specific:

    Use element-by-id command to find org elements by ID property

    line 186
  30. Distinctive:

    All file paths are validated at construction, not runtime

    line 192
  31. Very specific:

    Use shellexpand for path expansion

    line 193
  32. Very specific:

    Default org directory is ~/org/ but can be overridden

    line 194
  33. Very specific:

    Use nix develop for development shell with all dependencies

    line 204
  34. Distinctive:

    ALWAYS: run the complete test suite before committing

    line 212
  35. Distinctive:

    ALWAYS: use appropriate timeouts (90+ seconds for builds, 30+ seconds for tests)

    line 213

≈ “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

org-mcp-server

org-mcp-server is a Rust Model Context Protocol (MCP) server for org-mode knowledge management. It provides search, content access, and note linking capabilities for org-mode files through the MCP protocol.

ALWAYS reference these instructions first and fallback to the CLAUDE.md file, search, or bash commands only when you encounter unexpected information that does not match the info here.

Working Effectively

Bootstrap and Build

  • NEVER CANCEL builds or tests - they may take up to 90 seconds to complete
  • Build the workspace: cargo build -- takes ~47 seconds. NEVER CANCEL. Set timeout to 90+ seconds.
  • Release build: cargo build --release -- takes ~47 seconds. NEVER CANCEL. Set timeout to 90+ seconds.
  • Run tests: cargo test -- takes ~2 seconds, 36 tests. Safe timeout 30+ seconds.
  • Lint code: cargo clippy -- takes ~11 seconds. Safe timeout 30+ seconds.
  • Format code: cargo fmt -- takes <1 second. Always run before commits.
  • Check formatting: cargo fmt --check -- takes <1 second.

Development Commands

  • Run CLI tool: cargo run --bin org-cli -- --help
  • Run MCP server: cargo run --bin org-mcp-server (needs valid org directory)
  • Run examples: cargo run --example <name> (examples in org-core/examples/)
  • Test specific crate: cargo test -p <crate-name>
  • Build specific crate: cargo build -p <crate-name>

Validation

CRITICAL: Always Test These Scenarios After Changes

  1. Build validation: Run cargo build and wait for completion (90+ seconds)
  2. Test validation: Run cargo test and verify all 36 tests pass
  3. CLI validation: Test core CLI functionality:

    cargo run --bin org-cli -- list --dir org-core/tests/fixtures
    cargo run --bin org-cli -- read --dir org-core/tests/fixtures sample.org
    cargo run --bin org-cli -- outline --dir org-core/tests/fixtures sample.org
    cargo run --bin org-cli -- element-by-id --dir org-core/tests/fixtures simple-123
  4. Linting validation: Run cargo clippy and cargo fmt --check

Manual Testing Requirements

  • ALWAYS test the CLI with actual org files after making changes
  • ALWAYS verify that the core functionality works with test fixtures
  • Use org-core/tests/fixtures/ for testing - contains 8 org files with various structures
  • Test files include: sample.org, with_ids.org, nested.org, etc.

Project Structure

Multi-Crate Workspace

  • org-core — Business logic and org-mode parsing (org-core/src/)
  • mcp-server — MCP protocol implementation (mcp-server/src/)
  • org-cli — CLI interface for testing (org-cli/src/)

Key Directories

  • org-core/examples/ — Playground examples for experimentation
  • org-core/tests/fixtures/ — Test org files for validation
  • org-core/src/ — Core business logic (lib.rs, org_mode.rs, error.rs)
  • mcp-server/src/ — MCP server (main.rs, core.rs, resources/, tools/)
  • org-cli/src/ — CLI tool implementation

Configuration Files

  • Cargo.toml — Workspace configuration
  • flake.nix — Nix development environment
  • CLAUDE.md — Development guidelines
  • README.md — Project documentation

Architecture and Dependencies

Tech Stack

  • Rust 2024 edition with async-first design using tokio
  • orgize for org-mode parsing
  • rmcp for MCP protocol implementation
  • clap for CLI interface
  • walkdir for file traversal
  • serde/serde_json for serialization

Error Handling

  • Use custom error types with proper chaining
  • Prefer explicit Result<T, E> over panics
  • Check org-core/src/error.rs for error definitions

Development Workflow

Making Changes

  1. Always start by running the full validation suite
  2. Make focused, minimal changes
  3. Build immediately after changes: cargo build (wait 90+ seconds)
  4. Test immediately after changes: cargo test
  5. Always run CLI validation scenarios
  6. Always run cargo clippy and cargo fmt before committing

Code Style

  • Use cargo fmt before all commits
  • Use "string {var}" over "string {}", var
  • Standard library imports before external crates
  • Add #[cfg(test)] modules for tests
  • Use assert_eq! over assert! in tests

Testing Strategy

  • Unit tests in each crate with #[cfg(test)] modules
  • Integration tests use fixtures in org-core/tests/fixtures/
  • CRITICAL: Always test with real org files using CLI commands
  • Test files contain various org-mode features (headings, IDs, properties)

Common Tasks

Repository Root Structure

.
├── Cargo.toml          # Workspace config
├── README.org          # Project documentation
├── CLAUDE.md           # Development guidelines
├── flake.nix           # Nix development environment
├── org-core/           # Core business logic
│   ├── src/
│   ├── examples/       # Experimentation examples
│   └── tests/fixtures/ # Test org files
├── mcp-server/         # MCP protocol server
│   └── src/
└── org-cli/            # CLI tool
    └── src/

Frequently Used Commands Output

CLI Help:

$ cargo run --bin org-cli -- --help
A CLI tool for org-mode functionality

Usage: org-cli <COMMAND>

Commands:
  list           List all .org files in a directory
  init           Initialize or validate an org directory
  read           Read the contents of an org file
  outline        Get the outline (headings) of an org file
  heading        Extract content from a specific heading
  element-by-id  Extract content from an element by ID
  help           Print this message or help of subcommand

Test Fixtures List:

$ cargo run --bin org-cli -- list --dir org-core/tests/fixtures
Found 8 .org files in org-core/tests/fixtures:
  edge_cases.org
  doc_with_id.org
  nested.org
  sample.org
  multi_file_a.org
  with_ids.org
  multi_file_b.org
  simple.org

Key Implementation Details

ID-Based Element Lookup

  • Use element-by-id command to find org elements by ID property
  • Test with: cargo run --bin org-cli -- element-by-id --dir org-core/tests/fixtures simple-123
  • IDs are defined in :PROPERTIES: blocks in org files

File Operations

  • All file paths are validated at construction, not runtime
  • Use shellexpand for path expansion
  • Default org directory is ~/org/ but can be overridden

MCP Server Limitations

  • Current MCP server implementation needs directory configuration improvements
  • Server provides resources: org://, org://file, org-outline://, `org-he
  • Tools available: org-file-list

Nix Development Environment

  • Use nix develop for development shell with all dependencies
  • Flake provides rust toolchain, cargo tools, and formatters
  • Pre-commit hooks available for formatting and linting

CRITICAL REMINDERS

  • NEVER CANCEL build commands - they may take 90+ seconds
  • ALWAYS validate with CLI scenarios after changes
  • ALWAYS run the complete test suite before committing
  • ALWAYS use appropriate timeouts (90+ seconds for builds, 30+ seconds for tests)
  • Build times are normal - do not attempt to interrupt or optimize prematurely

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.