claude-code: declare the account agents run as and the command that starts it

The control node is to run its agents under an account that cannot become root
(hq ADR 0266). Declare it as a user the node-engine judges root: never, put the
agent's directory in its home, and place claude-agent so the operator starts a
session there through their own sudo. Where no agent account is named, both
name the operator's account, as before.
This commit is contained in:
jochen
2026-10-09 10:14:25 +02:00
parent c8fb0016f2
commit 17b0ac9f6c
2 changed files with 29 additions and 3 deletions
+15 -2
View File
@@ -84,12 +84,25 @@
"path": "/etc/claude-code",
"mode": "0755"
},
{
"id": "start",
"type": "file",
"path": "/usr/local/bin/claude-agent",
"mode": "0755",
"content": "#!/bin/sh\n# The mesh's (module claude-code, novox/hq ADR 0266): start the agent as the account agents run as on this\n# machine. Written whole at every push: an edit here is overwritten.\nagent='${machine:agent-account}'\nif [ \"$(id -un)\" = \"$agent\" ]; then\n\texec claude \"$@\"\nfi\n# Another account, the operator's, becomes the agent's through its own sudo: the person is the authority. The\n# operator's override of the guard travels only when it is set in this shell, as it would reach claude.\nif [ -n \"$MESH_GUARD_OVERRIDE\" ]; then\n\texec sudo -iu \"$agent\" env MESH_GUARD_OVERRIDE=\"$MESH_GUARD_OVERRIDE\" claude \"$@\"\nfi\nexec sudo -iu \"$agent\" claude \"$@\"\n"
},
{
"id": "agent-account",
"type": "user",
"name": "${machine:agent-account}",
"root": "${machine:agent-root}"
},
{
"id": "agent-home",
"type": "directory",
"path": "${machine:account-home}/.claude",
"path": "${machine:agent-home}/.claude",
"mode": "0700",
"owner": "${machine:account}"
"owner": "${machine:agent-account}"
},
{
"id": "state",