Skip to main content
Glama
Cohexa-ai

Agent Coherence — Stale Write Guard (FS)

Official
by Cohexa-ai

swg_read

Read a workspace file and return its content plus coherence metadata (version and owner generation) to detect stale state and guard external actions against concurrent overwrites.

Instructions

Read a workspace text file under coherence tracking. Returns {content, version, owner_generation}. The version is the comparand you pass to swg_write_cas; KEEP BOTH version and owner_generation and pass them to swg_gate before any irreversible external action you decide from this read (owner_generation=null means this coordinator does not report generations, so swg_gate will hold). A sticky-INVALID view returns fresh bytes but stays INVALID — use swg_reacquire to recover before writing. 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

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.12.0

TDQS

A4.7/5.0
Behavior5/5

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

The description provides substantial behavioral detail beyond annotations: it specifies the exact return contract, the meaning of null owner_generation, the sticky-INVALID semantics, the SINGLE-HOST limitation, and the list of out-of-guarantee scenarios. It also implicitly discloses that reads can leave the view in a non-writable INVALID state, which is non-obvious behavior.

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

Conciseness5/5

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

The description is long but every sentence carries necessary information: purpose, return contract, downstream workflow, failure mode, host constraint, and explicit non-guarantees. The most important usage guidance is front-loaded early, and the limitations are compactly listed at the end. No filler or repetition.

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?

With no output schema and only a minimal readOnly annotation, the description carries heavy responsibility. It provides return values, usage protocol, error/recovery behavior, operational constraints, and explicit non-guarantees. This is complete enough for an agent to call the tool correctly and understand the consequences.

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

Parameters3/5

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

The only parameter, path, is a required string in the schema with 0% description coverage. The description adds the context that the path refers to a workspace text file under coherence tracking, which orients the agent about the kind of path to provide. It doesn't describe path syntax, existence requirements, or valid forms, but the single parameter is self-evident enough to make this adequate.

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 specific verb ('Read') and resource ('workspace text file under coherence tracking'), and clearly differentiates from siblings by describing the read/cas/gate/adquire workflow. An agent can see this is the read entry point and not confuse it with write, status, gate, or reacquire.

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?

The description explicitly guides when to use this tool and what to do with its output: pass version and owner_generation to swg_gate before irreversible actions, pass version to swg_write_cas, and use swg_recquire to recover from a sticky-INVALID view. It effectively contrasts with siblings by naming them in the appropriate workflow context.

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