claude-code: remove the guard on the agent's shell

The operator asked for the shell guard to go (2026-11-20): the plugin no
longer carries a PreToolUse hook or guard.json, the binary no longer has
a guard verb, and the claude_code_guard tool, its record and the
refusal-ranked order of the instead-of table are gone. The SessionStart
and Stop hooks of the wait list stay, run by the same binary at the same
path, which is also the home-fs helper's. The rendered rule against ssh
to a mesh machine stays as the session's own and no longer claims a
guard enforces it; claude-agent no longer passes the guard's override.
This commit is contained in:
2026-11-20 13:06:55 +01:00
parent 8b91552f59
commit f57ae96e55
18 changed files with 66 additions and 1737 deletions
+5 -64
View File
@@ -1,7 +1,6 @@
package main
// What the mesh says about its own tools and machines, as the agent's instructions and the guard on its
// shell need it (novox/hq ADR 0245): every seat verb and module tool that says what shell command it
// What the mesh says about its own tools and machines, as the agent's instructions need it (novox/hq ADR 0245): every seat verb and module tool that says what shell command it
// replaces, and the mesh's machines by every name and address a session could reach one by.
//
// Read from the bus at start and every few minutes (issue 1126 B13; the controller that answered this before is
@@ -9,7 +8,7 @@ package main
// own tools from the manifests the indexer keeps (`mesh-delivery-indexer.modules` and `.manifests`), and the
// machines and where each module runs from the seat mesh-module-assigner's `assignments`. Kept in the module's state so
// a render never waits for the bus, and rendered whenever it changes. Nothing here is written by hand: a verb
// that gains a `replaces` is in the next render's table and the guard's next refusal.
// that gains a `replaces` is in the next render's table.
import (
"context"
@@ -58,20 +57,6 @@ type MeshTools struct {
Machines []Machine `json:"machines"`
// Asked is when the bus was last read whole.
Asked string `json:"asked,omitempty"`
// Refused is how often the guard here named each tool instead of a work-around, from its record: the
// table's order. Never kept — read from the record at each render.
Refused map[string]int `json:"-"`
}
// RefusedCounts are how often the guard's record named each tool, over its last lines.
func RefusedCounts(log string) map[string]int {
out := map[string]int{}
for _, e := range ReadGuardLog(log, 2000) {
for _, t := range e.Tools {
out[t]++
}
}
return out
}
// InternalSuffix is the mesh's own names' domain: every machine and service is `<name>.internal`
@@ -295,22 +280,9 @@ func KeepMeshTools(p Paths, m MeshTools) bool {
return os.Rename(tmp, p.meshTools()) == nil
}
// GuardDataOf is what the guard judges with on this machine.
func GuardDataOf(p Paths, m *MeshTools) GuardData {
d := GuardData{Node: p.Node, Log: filepath.Join(p.State, "guard.log"), Machines: []Machine{}, Replacements: []Replacement{}}
if p.Confined() {
// The session's account cannot write the module's state, and must not rewrite its own record (ADR 0266).
d.Agent, d.Log = p.Agent, JournalRecord+GuardJournalID
}
if m != nil {
d.Machines, d.Replacements = m.Machines, m.Replacements
}
return d
}
// guardFiles is the guard to place: this module's own executable and what it judges with. None where the
// hookFiles is what the plugin's hooks run: this module's own executable and the waits directory. None where the
// executable cannot be named — then no hook is written, rather than one that cannot run.
func guardFiles(p Paths, m *MeshTools) *GuardFiles {
func hookFiles(p Paths) *HookFiles {
exe, err := os.Executable()
if err != nil {
return nil
@@ -318,7 +290,7 @@ func guardFiles(p Paths, m *MeshTools) *GuardFiles {
if resolved, err := filepath.EvalSymlinks(exe); err == nil {
exe = resolved
}
return &GuardFiles{Exe: exe, Data: GuardDataOf(p, m), WaitsDir: WaitsDirPath(p)}
return &HookFiles{Exe: exe, WaitsDir: WaitsDirPath(p)}
}
// MeshToolsEvery is how often the machines' addresses are resolved again; the tools and the assignments are read again
@@ -361,37 +333,6 @@ func refreshMeshTools(p Paths) {
}
}
// GuardStatus is what claude_code_guard answers.
func GuardStatus(p Paths, last int) map[string]any {
m := ReadMeshTools(p)
d := GuardDataOf(p, m)
asked := "never: the bus has not been read whole yet"
if m != nil {
asked = m.Asked
}
return map[string]any{
"refuses": []string{
"ssh, scp, sftp, rsync, mosh or autossh to a mesh machine: its name, a name under its domains, any *" + InternalSuffix +
" name or one of its addresses, read as ssh reads it (ssh -G); a jump through one too. An ssh login as `" +
ForgeUser + "` is the forge's account and passes",
"writing /etc/hosts or /etc/resolv.conf, by the shell or the agent's Edit and Write",
"HOSTALIASES, named anywhere in a command",
"any command naming " + OverrideVar,
"where the machine names an agent account of its own (novox/hq ADR 0266): every command and file edit of a " +
"session that does not run as it, whatever it is, and no override lifts it",
},
"agent_account": map[bool]string{true: p.Agent, false: "none of its own: agents run as the operator's account"}[p.Confined()],
"override": OverrideVar + "=<why>, set in the operator's own shell before the session starts; read from the session's " +
"environment as it was started, recorded with why, and not honoured when it cannot be recorded",
"hook": GuardCommand(),
"asked": asked,
"machines": d.Machines,
"replacements": d.Replacements,
"instead_of": InsteadOf(m),
"record": ReadGuardLog(d.Log, last),
}
}
// seatList is the seat list this module holds: the definitions of the seats, read from the seat mesh-catalog and
// followed on its events (novox/hq ADR 0635 §1, ADR 0636), the foundation's bootstrapped ones until it answers.
var seatList *seatlist.Reader