A snapshot: read at commit 707a04c7ce8 on 2026-10-18T00:06:01Z by majordomus 0.29.0. Nothing on this page is read again. See it live
guard.edit
Judge one edit
What it is
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.
Descriptor
- Canonical id
guard.edit- Module
guard- Kind
- query
- Stability
- experimental
- Provenance
- declared
- Source
apps/majordomus-cli/src/capability/builtin/guard.rs- Cache
disabled- Benchmark
required- Tags
- guardmeshcoordination
Run
queryA query. It reads and changes nothing.
Projections
| Interface | As | Where |
|---|---|---|
| MCP tool | majordomus_guard_edit | - |
| MCP resource | not exposed | - |
| HTTP | GET /api/v1/guard/edit | Swagger |
| Command line | not exposed | - |
Schemas
Input · GuardEditInput
{
"type": "object",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"description": "The path about to be written: absolute, or relative to the repository root."
},
"session": {
"type": [
"string",
"null"
],
"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."
}
},
"required": [
"path"
],
"description": "Which write to judge.",
"title": "GuardEditInput"
}Output · EditVerdict
{
"type": "object",
"properties": {
"allowed": {
"type": "boolean",
"description": "Whether the edit may proceed."
},
"path": {
"type": "string",
"description": "The path asked about, repository-relative when it is inside the checkout."
},
"ground": {
"type": "string",
"description": "Why, as one word: `off`, `outside`, `local`, `no_mesh`, `task`, `claim`,\n`undecided` or `unclaimed`. Only `unclaimed` refuses."
},
"detail": {
"type": "string",
"description": "The sentence a person reads."
},
"remedy": {
"type": [
"string",
"null"
],
"description": "What makes the edit allowed, when it is refused."
}
},
"required": [
"allowed",
"path",
"ground",
"detail"
],
"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```",
"title": "EditVerdict"
}Examples
These are the capability's own benchmark cases: the same inputs the benchmark runs and the OpenAPI document shows.
in-repository
{
"path": "docs/MESH.md",
"session": "claude-code-bench"
}outside
{
"path": "/nonexistent/outside.txt"
}