Skip to content

guard.edit

Whether the given session may write the given path now: allowed when the policy's session.edits_require_claim is off, the path is outside the checkout or its local state, the repository declares no enabled mesh, the active task's scope covers it, or a live mesh claim of the session covers it; refused as unclaimed otherwise, with the remedy. What cannot be read — the policy, the mesh — is let through and named, never refused.

Whether the given session may write the given path now: allowed when the policy's session.edits_require_claim is off, the path is outside the checkout or its local state, the repository declares no enabled mesh, the active task's scope covers it, or a live mesh claim of the session covers it; refused as unclaimed otherwise, with the remedy. What cannot be read — the policy, the mesh — is let through and named, never refused.

Exposure

Where this one definition is reachable. Absence is explicit: a surface not listed does not carry it.

surfaceas
MCPtool majordomus_guard_edit
HTTPGET /api/v1/guard/edit operationId guard.edit
command line—

Schemas

The canonical input and output, from the Rust types; the MCP tool schema and the OpenAPI parameters and responses are derived from these.

input · GuardEditInput

Which write to judge.
propertytyperequireddescription
path string yes The path about to be written: absolute, or relative to the repository root.
session string | null no The writing session's id on the mesh (claude-code-<session id> for Claude Code); without it only the active task's scope can cover the write.
JSON Schema
{
  "additionalProperties": false,
  "description": "Which write to judge.",
  "properties": {
    "path": {
      "description": "The path about to be written: absolute, or relative to the repository root.",
      "type": "string"
    },
    "session": {
      "description": "The writing session's id on the mesh (`claude-code-<session id>` for Claude Code);\nwithout it only the active task's scope can cover the write.",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "path"
  ],
  "title": "GuardEditInput",
  "type": "object"
}

output · EditVerdict

The answer to one edit: whether it may proceed, the one word it was decided on, the sentence a person reads and, for a refusal, what would allow it. guard.edit returns it as it is; guard hook turns it into an exit code.

use majordomus_cli::guard::{judge_facts, ClaimSource, EditFacts, EditVerdict};

let facts = EditFacts {
    required: Ok(false),
    mesh_enabled: true,
    task: None,
    session: None,
    claims: ClaimSource::Claims(vec![]),
};
let v: EditVerdict = judge_facts("a.md", Some("a.md"), facts);
assert!(v.allowed);
assert_eq!(v.ground, "off");
let json = serde_json::to_value(&v).unwrap();
assert!(json.get("remedy").is_none(), "an allowed edit carries no remedy");
propertytyperequireddescription
allowed boolean yes Whether the edit may proceed.
detail string yes The sentence a person reads.
ground string yes Why, as one word: off, outside, local, no_mesh, task, claim, undecided or unclaimed. Only unclaimed refuses.
path string yes The path asked about, repository-relative when it is inside the checkout.
remedy string | null no What makes the edit allowed, when it is refused.
JSON Schema
{
  "description": "The answer to one edit: whether it may proceed, the one word it was decided on, the\nsentence a person reads and, for a refusal, what would allow it. `guard.edit` returns it\nas it is; `guard hook` turns it into an exit code.\n\n```\nuse majordomus_cli::guard::{judge_facts, ClaimSource, EditFacts, EditVerdict};\n\nlet facts = EditFacts {\n    required: Ok(false),\n    mesh_enabled: true,\n    task: None,\n    session: None,\n    claims: ClaimSource::Claims(vec![]),\n};\nlet v: EditVerdict = judge_facts(\"a.md\", Some(\"a.md\"), facts);\nassert!(v.allowed);\nassert_eq!(v.ground, \"off\");\nlet json = serde_json::to_value(&v).unwrap();\nassert!(json.get(\"remedy\").is_none(), \"an allowed edit carries no remedy\");\n```",
  "properties": {
    "allowed": {
      "description": "Whether the edit may proceed.",
      "type": "boolean"
    },
    "detail": {
      "description": "The sentence a person reads.",
      "type": "string"
    },
    "ground": {
      "description": "Why, as one word: `off`, `outside`, `local`, `no_mesh`, `task`, `claim`,\n`undecided` or `unclaimed`. Only `unclaimed` refuses.",
      "type": "string"
    },
    "path": {
      "description": "The path asked about, repository-relative when it is inside the checkout.",
      "type": "string"
    },
    "remedy": {
      "description": "What makes the edit allowed, when it is refused.",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "allowed",
    "path",
    "ground",
    "detail"
  ],
  "title": "EditVerdict",
  "type": "object"
}

Policies

benchmark
required — a target on every transport the exposure declares; the cases are the input type's
cache
disabled — every call runs the handler

Benchmark targets

Derived from the registry for this repository: one requirement per transport, and the cases the input type provides. The whole matrix is on the benchmarks page.

transportstatecasestargets
directcovered2in-repository
outside
mcpcovered2in-repository
outside
httpcovered2in-repository
outside

Searches the titles and descriptions of every page this site publishes.