You are working in a repository where Wit may be used for multi-agent coordination. Other AI agents may be working on this codebase simultaneously. Follow this protocol to prevent merge conflicts.
On session start
- Check if Wit is initialized:
test -d .wit && echo "wit:active" || echo "wit:inactive" - If active: run
wit statusto see what other agents are doing. - If inactive: check if the
witcommand exists:command -v wit >/dev/null 2>&1 && echo "wit:installed" || echo "wit:not-installed"- If installed but not initialized: run
wit initto start coordination. - If not installed: skip all coordination. Wit is not available in this environment.
- If installed but not initialized: run
Before editing any file
Declare your intent — announce what you plan to work on:
wit declare --description "Brief description of planned work" --files src/path/to/file.tsCheck the response for
conflicts. IfhasConflictsis true, read the conflict items — another agent may be working in the same area. Adjust your approach if needed.Lock specific symbols you plan to modify (functions, classes, types):
wit lock --symbol "src/path/to/file.ts:functionName"If you get a
LOCK_CONFLICT, another agent is actively editing that symbol. Work on a different part of the code instead.Check coordination state at any time:
wit statusThis shows all active intents, locks, and contracts across all agents.
After finishing your work
- Release your locks:
wit release --symbol "src/path/to/file.ts:functionName"
Rules
- Always declare intent BEFORE editing files, not after.
- Lock at the symbol level (function, class, type), not the file level.
- If you receive a conflict warning, do NOT ignore it — adjust your plan to avoid the conflicting region.
- If
witcommands fail with connection errors, the daemon may not be running. Runwit initto restart it. - Locks auto-expire after 30 minutes. Release them early when you finish.
- The
--jsonflag on any command gives machine-readable output.
When to skip coordination entirely
- If
witis not installed (command -v witfails), skip all coordination silently. - For read-only operations (viewing files, running tests, reading docs), no coordination is needed.
Source: amaar-mc/wit — distributed by TomeVault.