Skip to main content

Lockfile and State

AgentMesh persists state across three surfaces with different lifecycles:

SurfaceLocationCommitted?Purpose
Repositoryagentmesh.lock, .ai/, AGENTS.mdYesShared resolved state
Repository (gitignored).claude/settings.local.json, .codex/hooks.jsonNoPer-machine hooks
Machine cache~/.cache/agentmesh/<repo-hash>/N/AIntegrity, queue, conflicts

agentmesh.lock

A YAML file at the repo root — modeled on Cargo.lock or pnpm-lock.yaml. Generated by AgentMesh, committed to git, reviewed in PRs.

Top-level shape:

version: 1
schema: 1

entities:
skill:security-review:
type: skill
locations:
.ai: skills/security-review/SKILL.md
.claude: skills/security-review/SKILL.md
.codex: skills/security-review/SKILL.md
canonical_sha256: abc123…
emitted_native_sha256:
.ai: abc123…
.claude: abc123…
.codex: abc123…

adapters:
claude:
mode: bundled
protocol_version: 1
entities: [instructions, skill, subagent]
codex:
mode: bundled
protocol_version: 1
entities: [instructions, skill, subagent]

Key fields per entity

FieldPurpose
canonical_sha256Hash of canonical form — ancestor for three-way merge
emitted_native_sha256Per-location hash of bytes AgentMesh last wrote (post-translation)
pending_conflict_resolutionSet after tiebreaker; cleared by ack or restore
lineageHow the entity entered the canonical model
overrides (top-level)Opt-in per-runtime field divergence

Do not edit agentmesh.lock by hand. Use agentmesh reconcile-lock for git merge conflicts.

agentmesh.config.yaml

Optional user-edited intent file. Every key is optional — a project with no config file runs full bidirectional sync with defaults.

See Configuration for the full schema.

AgentMesh creates this file only if absent during init; it never modifies it afterward.

Machine-local cache

Located at ~/.cache/agentmesh/<repo-hash>/ (platform equivalents on macOS/Windows):

File / directoryPurpose
integrity.jsonPinned binary path + sha256
hook-ownership.jsonWhich hook entries AgentMesh installed
pending-syncs/Drainer queue
conflicts/Archived losing versions from auto-resolved conflicts
watcher.pidWatcher daemon process ID
*.lockAdvisory locks for concurrent sync

Never commit cache contents. Each machine has its own cache.

Git merge conflicts

When agentmesh.lock has a textual merge conflict:

agentmesh reconcile-lock
git diff agentmesh.lock # review
git add agentmesh.lock && git commit

The command merges entity entries from both sides, re-scans the filesystem, and writes a clean lockfile. It does not auto-commit.

Schema compatibility

  • Read backward: older AgentMesh reads newer lockfiles until schema version exceeds support
  • No read forward: running an old binary on a newer schema produces a clear upgrade error (exit code 4)