Skip to main content
Glama
Cohexa-ai

Agent Coherence — Stale Write Guard (FS)

Official
by Cohexa-ai

swg_gate

Verify a file is STILL unchanged and still under the same grant. Pass BOTH comparands from your earlier swg_read — expected_version AND expected_generation (its owner_generation).

Instructions

Verify a file is STILL unchanged and still under the same grant. Pass BOTH comparands from your earlier swg_read — expected_version AND expected_generation (its owner_generation). Call this immediately BEFORE any irreversible external action you decided from that read (sending a webhook, opening a PR, running a deploy, posting a message). Returns decision=proceed, or DENIES with reason=stale_view if the file moved OR the grant you read it under was reclaimed (the version alone cannot see a reclaim) OR a peer write-claim preempted your grant (which moves neither comparand — the gate re-checks that the grant still stands) OR either comparand is unconfirmed. On a deny: do NOT take the action — swg_reacquire, re-read, re-decide. SINGLE-HOST only. Out of guarantee and NOT detected in v1: writers on different hosts or across a synced/network mount, divergent-history reconciliation, semantic correctness, server-enforced auto-merge.

Input Schema

NameRequiredDescriptionDefault
pathYes
expected_versionYes
expected_generationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.14.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The only annotation is readOnlyHint=false, which carries almost no actionable information, so the description bears the full burden and delivers: it enumerates the distinct deny causes (stale version, reclaimed grant, peer preemption, unconfirmed comparand), states that version alone cannot detect a reclaim, and lists out-of-guarantee scenarios (multi-host, network mounts, divergent history, semantic correctness, auto-merge).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the core purpose and the 'call it immediately before' instruction, and every clause carries decision-relevant content. It is dense and somewhat run-on, particularly the long parenthetical listing deny reasons, but nothing is padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, yet the description documents the return contract (decision=proceed, or DENIES with reason=stale_view), the failure-recovery path, and the tool's guarantee boundaries. An agent has everything needed to call it, interpret the result, and act correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It does so for the two non-obvious integers — both comparands must come from the earlier swg_read, and expected_generation is identified as the owner_generation — which is meaning the schema cannot convey. It does not explain `path`, though that parameter is largely self-evident.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a precise verb+resource+scope: verify a file is STILL unchanged and under the same grant, using both comparands. An agent can distinguish it from siblings like swg_read (initial read) and swg_reacquire (recovery after deny) without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when: 'Call this immediately BEFORE any irreversible external action you decided from that read', with concrete examples (webhook, PR, deploy, message). Explicit what-to-do-on-failure: 'do NOT take the action — swg_reacquire, re-read, re-decide', naming the alternative sibling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.