Skip to main content

agent-file-claim

Two coding agents on one machine, one file: the later edit quietly undoes the earlier one. This hook stops it. A session's first write to a file claims it; another session's write to that file is refused, with who holds it and until when, so the agent works on another file or waits. The holder's next write renews the claim, its session end frees its files, and an hour without a write frees them too. Nothing leaves your machine; it needs only Python 3.9 or later, on Linux or macOS.

pipx install agent-file-claim

Claude Code

Add to ~/.claude/settings.json (or install the plugin: /plugin marketplace add https://huggingface.co/memento-team/claude-plugins.git, then /plugin install agent-file-claim@memento-team):

{
  "hooks": {
    "PreToolUse": [{"matcher": "Edit|Write|MultiEdit|NotebookEdit",
                    "hooks": [{"type": "command", "command": "agent-file-claim hook"}]}],
    "SessionEnd": [{"hooks": [{"type": "command", "command": "agent-file-claim end"}]}]
  }
}

Codex

Add to ~/.codex/hooks.json; Codex asks you to trust the hooks at the next start:

{
  "hooks": {
    "PreToolUse": [{"matcher": "^apply_patch$",
                    "hooks": [{"type": "command", "command": "agent-file-claim hook"}]}],
    "SessionEnd": [{"matcher": "*", "hooks": [{"type": "command", "command": "agent-file-claim end", "timeout": 3}]}]
  }
}

What a refused write says

refused: /work/app/src/auth.py is held by session 3f9c2a1b in /work/app since 14:02 UTC, until 15:02 UTC unless it writes
again. Another live session is editing it: work on another file, or wait for that session to end.
Only if that session is gone: agent-file-claim release /work/app/src/auth.py

Commands

  • agent-file-claim lists the files held and the count of writes refused.
  • agent-file-claim release PATH frees one file.
  • --minutes N sets the lease (default 60; 0 turns the hook off), --skip "*.lock,CHANGELOG.md" names files any session may write, --dir where the claims live (default ~/.memento).

Claude Code and Codex sessions share the same claims. Across machines, memento Team keeps one owner per file for the whole team: https://overflow.games/memento/?ref=pypi-claim

MIT license.

Metadata

Release files for agent-file-claim 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-file-claim 0.1.0
File Size Uploaded Provenance
agent_file_claim-0.1.0.tar.gz 6.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agent-file-claim 0.1.0
File Interpreter ABI Platform
agent_file_claim-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / agent_file_claim-0.1.0.tar.gz

Download URL agent_file_claim-0.1.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cf5d33f42f9d4fdfedeb3cb01976fe4c17d6c906b9a9ba68f1b4f689c3688850
BLAKE2b-256 checksum
How to use checksums
412230f0f4289e9f0e1720ab0e65d76b8df125575fe3f5a71a2b87b5d7c55807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / agent_file_claim-0.1.0-py3-none-any.whl

Download URL agent_file_claim-0.1.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12b0bc5535b58febb81a606fe5a4ee9dfb8efd0a2590751785093891d9e56c82
BLAKE2b-256 checksum
How to use checksums
f5338e7b5b2f08d343bffa2a71fa79bf9bd77d2da00dd312cd46fa40af48939d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for agent-file-claim 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page