modelcontextprotocol / modelcontextprotocol/servers

Filesystem Edit Logs

Open
#794 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement server-filesystem
Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

Feature Request (Claude Code and / or Claude Desktop MacOS):

  • Filesystem edit logs in .json format
  • Track historic edits with context
  • Supports version control tracking w/out git
  • Filesystem logs can be read later to give successive chats immediate context into historic work
  • Additional Product Enhancement for Desktop Claude: Enable MacOS tag operability so any files can be tagged with tags to identify in the Finder UI any files which have been edited by Claude Desktop

I asked Claude to provide me with a sample SOP that I could anchor to future Projects in the App / Web UI and/or point at if using Claude Code when it examines all files w/in a /config directory, and here's what Claude drew up.

I think it's a pretty good first-pass:

Standard Operating Procedure: Claude Filesystem Activity Logging

Purpose and Scope

This document establishes the standard protocol for recording all filesystem operations performed by Claude within the user's environment. The procedure ensures consistent documentation of file creation, modification, and deletion activities for audit, security, and version control purposes.

Log File Location and Structure

Primary Log File

Claude shall maintain a primary activity log at:

/path/to/project/claude_activity_log.json
Secondary Log Files

For files subject to multiple modifications, Claude shall maintain differential logs at:

/path/to/project/logs/differential/{filename}_{timestamp}.json

Log Format Specification

Primary Log Structure

The primary log file shall use the following JSON schema:

{
  "entries": [
    {
      "timestamp": "YYYY-MM-DDThh:mm:ss.sssZ",
      "action": "[CREATE|EDIT|DELETE]",
      "filepath": "/absolute/path/to/file",
      "filesize": 12345,
      "checksum": "sha256-hash-of-file-contents",
      "operation_details": "Human-readable description of operation",
      "conversation_reference": {
        "conversation_id": "MCP-YYYY-MM-DD-NNN",
        "conversation_date": "YYYY-MM-DD",
        "conversation_topic": "Brief topic description",
        "conversation_first_query": "First few words of initial query"
      }
    }
  ]
}
Required Fields
Field Description Format/Type Required
timestamp UTC timestamp of operation ISO 8601 Yes
action Type of operation performed Enum (CREATE, EDIT, DELETE) Yes
filepath Full path to the affected file String Yes
filesize Size of file in bytes Integer Yes
checksum Hash of file contents SHA-256 string Yes
operation_details Description of changes String Yes
conversation_reference Metadata to identify originating conversation Object Yes
Additional Fields for EDIT Operations
Field Description Format/Type Required
previous_checksum Hash of file before changes SHA-256 string Yes
new_checksum Hash of file after changes SHA-256 string Yes
changes_summary Brief summary of changes String Yes
Conversation Reference Structure
Field Description Format/Type Required
conversation_id Unique identifier for referencing the conversation String Yes
conversation_date Date of the conversation ISO 8601 (YYYY-MM-DD) Yes
conversation_topic Brief description of conversation topic String Yes
conversation_first_query First few words of initial query String Yes

Differential Log Structure

For text-based files that undergo modification, a differential log shall be maintained with the following structure:

{
  "file": "/absolute/path/to/file",
  "timestamp": "YYYY-MM-DDThh:mm:ss.sssZ",
  "changes": [
    {
      "type": "[addition|deletion|modification]",
      "line_number": 42,
      "content": "Actual text content that was changed"
    }
  ],
  "conversation_reference": {
    "conversation_id": "MCP-YYYY-MM-DD-NNN",
    "conversation_date": "YYYY-MM-DD",
    "conversation_topic": "Brief topic description",
    "conversation_first_query": "First few words of initial query"
  }
}

Implementation Procedures

1. Log Initialization

When Claude first interacts with the filesystem and no log exists:

{
  "entries": [],
  "log_created": "YYYY-MM-DDThh:mm:ss.sssZ",
  "claude_version": "3.7 Sonnet"
}
2. Recording File Creation

When creating a new file, Claude shall:

  1. Generate a SHA-256 checksum of the file contents
  2. Record the file size
  3. Add an entry to the log with action "CREATE"
  4. Include conversation reference metadata
  5. Provide appropriate operation_details
3. Recording File Modifications

When modifying an existing file, Claude shall:

  1. Generate a SHA-256 checksum of the file before modification
  2. Make the required changes
  3. Generate a new SHA-256 checksum after modification
  4. Create a differential log if the file is text-based
  5. Add an entry to the main log with action "EDIT"
  6. Include both checksums and a changes_summary
  7. Include conversation reference metadata
4. Recording File Deletion

When deleting a file, Claude shall:

  1. Generate a SHA-256 checksum of the file to be deleted
  2. Add an entry to the log with action "DELETE"
  3. Include the final checksum and size before deletion
  4. Include conversation reference metadata

Examples

Example 1: Creating a New File
{
  "entries": [
    {
      "timestamp": "2024-05-15T14:42:15.326Z",
      "action": "CREATE",
      "filepath": "/path/to/project/instructions.md",
      "filesize": 2451,
      "checksum": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1",
      "operation_details": "Created new instruction document for MCP file management",
      "conversation_reference": {
        "conversation_id": "MCP-2024-05-15-001",
        "conversation_date": "2024-05-15",
        "conversation_topic": "MCP Implementation",
        "conversation_first_query": "Can you help me set up"
      }
    }
  ]
}
Example 2: Modifying a Configuration File
{
  "timestamp": "2024-05-15T14:45:22.118Z",
  "action": "EDIT",
  "filepath": "/path/to/project/config/config.json",
  "filesize": 758,
  "previous_checksum": "f6e5d4c3b2a1f0e9d8c7b6a5f4e3d2c1b0a9e8d7c6b5a4f3e2d1c0b9a8",
  "new_checksum": "1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0",
  "changes_summary": "Added new directory to mount points",
  "operation_details": "Modified configuration to include access to additional folder",
  "conversation_reference": {
    "conversation_id": "MCP-2024-05-15-001",
    "conversation_date": "2024-05-15",
    "conversation_topic": "MCP Implementation",
    "conversation_first_query": "Can you help me set up"
  }
}

Compliance Requirements

  1. All Claude instances must adhere to this logging format without exception
  2. Logs must be updated before file operations are committed
  3. Log entries must be appended in chronological order
  4. Fields must be populated with accurate data
  5. No log entries shall be modified or removed after creation

This Standard Operating Procedure shall be followed by all Claude instances operating within this environment regardless of conversation history or context.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file, test, or entry point is identified in the issue. Start by locating the filesystem-operation entry points and existing Desktop integration, then define the logging scope, JSON schema, history behavior, and macOS tagging requirements; done means those requirements are implemented and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, macos
Domain
desktop, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.