lock_files
Lock files before modifying them to prevent conflicts with other agents and avoid lost changes or merge conflicts in multi-agent projects.
Instructions
CRITICAL: Lock files before modifying them to prevent conflicts with other agents.
MANDATORY: Always lock files BEFORE making changes. This prevents:
Multiple agents editing the same file simultaneously
Lost changes and merge conflicts
Race conditions in multi-agent environments
WHEN TO USE:
Before editing any existing file
Before creating files in shared directories
Before refactoring code that spans multiple files
When you plan to modify files over an extended period
WORKFLOW:
lock_files() - Lock the files you plan to modify (THIS STEP)
Make your changes
log_change() - Log the changes made
unlock_files() - Release the locks when done
CONFLICT HANDLING: If files are already locked by another agent, you'll receive conflict information including which agent has the lock and when it expires. You should either:
Wait for the lock to be released
Coordinate with the other agent
Work on different files first
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"agent_id": "<agent_id>",
"project_id": "<project_id>",
"files": "<files>",
"reason": "<reason>"
},
"name": "lock_files"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | List of file paths to lock (required) - e.g., ["src/auth.ts", "src/utils.ts"] | |
| reason | Yes | Clear reason for locking (required) - e.g., "Implementing JWT authentication" | |
| agent_id | Yes | Your agent_id from register_agent() (required) | |
| project_id | Yes | Project ID from create_project() (required) | |
| expected_duration_minutes | No | How long you expect to hold the locks (default: 60) |