Skip to content

agentsmesh merge

Resolve .agentsmesh/.lock merge conflicts after a git merge. Rebuilds the lock file from the current canonical state.

Usage

Terminal window
agentsmesh merge
Terminal window
agentsmesh merge --global

Flags

FlagDescription
--globalResolve conflicts in ~/.agentsmesh/.lock.

When to use

Run agentsmesh merge after a git merge (or git rebase) that produces conflicts in .agentsmesh/.lock. Use agentsmesh merge --global for conflicts in ~/.agentsmesh/.lock.

The lock file is a YAML file containing checksums of the canonical .agentsmesh/ sources plus an outputs map of generated-file checksums. When two branches both modify canonical files and both regenerate, the lock files will conflict. Git cannot automatically resolve this.

Workflow

Terminal window
# 1. Pull and merge (lock file has conflicts)
git pull origin main
# CONFLICT (.agentsmesh/.lock): Merge conflict in .agentsmesh/.lock
# 2. Resolve canonical source conflicts first (if any)
# git status will show conflicting .agentsmesh/ files
# Resolve them manually, then stage
# 3. Rebuild the lock from current canonical state
agentsmesh merge
# 4. Regenerate to apply merged canonical sources
agentsmesh generate
# 5. Commit the resolved state
git add .agentsmesh/.lock .claude/ .cursor/
git commit -m "merge: resolve agentsmesh config conflicts"

What merge does

agentsmesh merge reads the current canonical files in .agentsmesh/ (or ~/.agentsmesh/ with --global) and rewrites the matching lock file with fresh canonical-source checksums computed from the current state.

It does not modify any canonical or generated files — it only fixes the lock file. The rewrite intentionally omits the outputs map (a merge changes canonical inputs), so agentsmesh check reports generated-output verification as skipped until you run agentsmesh generate to regenerate and refresh the lock — which the workflow above already does.

Collaboration strategies

The merge behavior can be configured in agentsmesh.yaml:

collaboration:
strategy: merge # merge | lock | last-wins
StrategyBehavior
mergeStandard 3-way merge. Use agentsmesh merge to resolve lock conflicts.
lockLocked features cannot be regenerated without --force.
last-winsAlways overwrite the lock with the latest state. No conflicts, but less safe.