From a2d226583fedb7bbc86868e202fcb4badb0c1352 Mon Sep 17 00:00:00 2001
From: m3tam3re
Date: Sun, 1 Nov 2026 13:09:34 +0100
Subject: [PATCH 1/3] fix(t3code): provide Beads to T3 Code agents on m3-hermes
bd was neither on the t3code service PATH nor on the system. Add it to
both, like the harnesses, and set BEADS_ACTOR so the audit trail matches
the m3ta-chiron commit identity.
Also take the bd 1.3.2 migration of .beads (config, gitignore, hooks) and
ignore the .beads.gate.lock it creates in the repo root.
Co-Authored-By: Claude Opus 5.5
---
.beads/.gitignore | 7 ++++
.beads/config.yaml | 3 +-
.beads/hooks/post-checkout | 57 +++++++++++++++++++++++------
.beads/hooks/post-merge | 57 +++++++++++++++++++++++------
.beads/hooks/pre-commit | 57 +++++++++++++++++++++++------
.beads/hooks/pre-push | 57 +++++++++++++++++++++++------
.beads/hooks/prepare-commit-msg | 57 +++++++++++++++++++++++------
.gitignore | 1 +
hosts/m3-hermes/services/t3code.nix | 7 +++-
9 files changed, 246 insertions(+), 57 deletions(-)
diff --git a/.beads/.gitignore b/.beads/.gitignore
index df4911d..3121a59 100644
--- a/.beads/.gitignore
+++ b/.beads/.gitignore
@@ -71,3 +71,10 @@ bd.db
# They would override fork protection in .git/info/exclude.
# Config files (metadata.json, config.yaml) are tracked by git by default
# since no pattern above ignores them.
+
+# Added by bd (missing required patterns)
+*.gate.lock*
+last_pull
+proxieddb/
+dolt-server-config.yaml
+proxied_server_client_info.json
diff --git a/.beads/config.yaml b/.beads/config.yaml
index d909ee4..a927682 100644
--- a/.beads/config.yaml
+++ b/.beads/config.yaml
@@ -53,4 +53,5 @@
# - github.org
# - github.repo
-sync.remote: "git+ssh://gitea@code.m3ta.dev/m3tam3re/nixos-config.git"
\ No newline at end of file
+sync:
+ remote: "git+ssh://gitea@code.m3ta.dev/m3tam3re/nixos-config.git"
diff --git a/.beads/hooks/post-checkout b/.beads/hooks/post-checkout
index d485872..9d53a6f 100755
--- a/.beads/hooks/post-checkout
+++ b/.beads/hooks/post-checkout
@@ -1,24 +1,59 @@
#!/usr/bin/env sh
-# --- BEGIN BEADS INTEGRATION v1.0.3 ---
+# --- BEGIN BEADS INTEGRATION v1.3.2 ---
# This section is managed by beads. Do not remove these markers.
if command -v bd >/dev/null 2>&1; then
export BD_GIT_HOOK=1
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
- if command -v timeout >/dev/null 2>&1; then
- timeout "$_bd_timeout" bd hooks run post-checkout "$@"
- _bd_exit=$?
- if [ $_bd_exit -eq 124 ]; then
- echo >&2 "beads: hook 'post-checkout' timed out after ${_bd_timeout}s — continuing without beads"
+ case "$_bd_timeout" in
+ *[!0-9]*|'') _bd_timeout_invalid=1 ;;
+ *[1-9]*) _bd_timeout_invalid=0 ;;
+ *) _bd_timeout_invalid=1 ;;
+ esac
+ if [ "$_bd_timeout_invalid" -eq 1 ]; then
+ echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
+ _bd_timeout=300
+ fi
+ _bd_timeout_backend=none
+ _bd_timeout_command=
+ for _bd_timeout_candidate in timeout gtimeout; do
+ if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
+ if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
+ case "$_bd_timeout_version" in
+ "timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
+ esac
+ fi
+ fi
+ done
+ if [ -n "$_bd_timeout_command" ]; then
+ _bd_timeout_backend=coreutils
+ if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run post-checkout "$@"; then
_bd_exit=0
+ else
+ _bd_exit=$?
+ fi
+ elif command -v perl >/dev/null 2>&1; then
+ _bd_timeout_backend=perl
+ if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run post-checkout "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
fi
else
- bd hooks run post-checkout "$@"
- _bd_exit=$?
+ echo >&2 "beads: hook 'post-checkout' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
+ if bd hooks run post-checkout "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
+ fi
fi
- if [ $_bd_exit -eq 3 ]; then
+ if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
+ echo >&2 "beads: hook 'post-checkout' timed out after ${_bd_timeout}s — continuing without beads"
+ _bd_exit=0
+ fi
+ if [ "$_bd_exit" -eq 3 ]; then
echo >&2 "beads: database not initialized — skipping hook 'post-checkout'"
_bd_exit=0
fi
- if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
+ if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
fi
-# --- END BEADS INTEGRATION v1.0.3 ---
+# --- END BEADS INTEGRATION v1.3.2 ---
diff --git a/.beads/hooks/post-merge b/.beads/hooks/post-merge
index 5aa3315..63f2260 100755
--- a/.beads/hooks/post-merge
+++ b/.beads/hooks/post-merge
@@ -1,24 +1,59 @@
#!/usr/bin/env sh
-# --- BEGIN BEADS INTEGRATION v1.0.3 ---
+# --- BEGIN BEADS INTEGRATION v1.3.2 ---
# This section is managed by beads. Do not remove these markers.
if command -v bd >/dev/null 2>&1; then
export BD_GIT_HOOK=1
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
- if command -v timeout >/dev/null 2>&1; then
- timeout "$_bd_timeout" bd hooks run post-merge "$@"
- _bd_exit=$?
- if [ $_bd_exit -eq 124 ]; then
- echo >&2 "beads: hook 'post-merge' timed out after ${_bd_timeout}s — continuing without beads"
+ case "$_bd_timeout" in
+ *[!0-9]*|'') _bd_timeout_invalid=1 ;;
+ *[1-9]*) _bd_timeout_invalid=0 ;;
+ *) _bd_timeout_invalid=1 ;;
+ esac
+ if [ "$_bd_timeout_invalid" -eq 1 ]; then
+ echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
+ _bd_timeout=300
+ fi
+ _bd_timeout_backend=none
+ _bd_timeout_command=
+ for _bd_timeout_candidate in timeout gtimeout; do
+ if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
+ if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
+ case "$_bd_timeout_version" in
+ "timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
+ esac
+ fi
+ fi
+ done
+ if [ -n "$_bd_timeout_command" ]; then
+ _bd_timeout_backend=coreutils
+ if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run post-merge "$@"; then
_bd_exit=0
+ else
+ _bd_exit=$?
+ fi
+ elif command -v perl >/dev/null 2>&1; then
+ _bd_timeout_backend=perl
+ if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run post-merge "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
fi
else
- bd hooks run post-merge "$@"
- _bd_exit=$?
+ echo >&2 "beads: hook 'post-merge' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
+ if bd hooks run post-merge "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
+ fi
fi
- if [ $_bd_exit -eq 3 ]; then
+ if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
+ echo >&2 "beads: hook 'post-merge' timed out after ${_bd_timeout}s — continuing without beads"
+ _bd_exit=0
+ fi
+ if [ "$_bd_exit" -eq 3 ]; then
echo >&2 "beads: database not initialized — skipping hook 'post-merge'"
_bd_exit=0
fi
- if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
+ if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
fi
-# --- END BEADS INTEGRATION v1.0.3 ---
+# --- END BEADS INTEGRATION v1.3.2 ---
diff --git a/.beads/hooks/pre-commit b/.beads/hooks/pre-commit
index d7ac3d9..0928485 100755
--- a/.beads/hooks/pre-commit
+++ b/.beads/hooks/pre-commit
@@ -1,24 +1,59 @@
#!/usr/bin/env sh
-# --- BEGIN BEADS INTEGRATION v1.0.3 ---
+# --- BEGIN BEADS INTEGRATION v1.3.2 ---
# This section is managed by beads. Do not remove these markers.
if command -v bd >/dev/null 2>&1; then
export BD_GIT_HOOK=1
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
- if command -v timeout >/dev/null 2>&1; then
- timeout "$_bd_timeout" bd hooks run pre-commit "$@"
- _bd_exit=$?
- if [ $_bd_exit -eq 124 ]; then
- echo >&2 "beads: hook 'pre-commit' timed out after ${_bd_timeout}s — continuing without beads"
+ case "$_bd_timeout" in
+ *[!0-9]*|'') _bd_timeout_invalid=1 ;;
+ *[1-9]*) _bd_timeout_invalid=0 ;;
+ *) _bd_timeout_invalid=1 ;;
+ esac
+ if [ "$_bd_timeout_invalid" -eq 1 ]; then
+ echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
+ _bd_timeout=300
+ fi
+ _bd_timeout_backend=none
+ _bd_timeout_command=
+ for _bd_timeout_candidate in timeout gtimeout; do
+ if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
+ if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
+ case "$_bd_timeout_version" in
+ "timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
+ esac
+ fi
+ fi
+ done
+ if [ -n "$_bd_timeout_command" ]; then
+ _bd_timeout_backend=coreutils
+ if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run pre-commit "$@"; then
_bd_exit=0
+ else
+ _bd_exit=$?
+ fi
+ elif command -v perl >/dev/null 2>&1; then
+ _bd_timeout_backend=perl
+ if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run pre-commit "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
fi
else
- bd hooks run pre-commit "$@"
- _bd_exit=$?
+ echo >&2 "beads: hook 'pre-commit' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
+ if bd hooks run pre-commit "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
+ fi
fi
- if [ $_bd_exit -eq 3 ]; then
+ if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
+ echo >&2 "beads: hook 'pre-commit' timed out after ${_bd_timeout}s — continuing without beads"
+ _bd_exit=0
+ fi
+ if [ "$_bd_exit" -eq 3 ]; then
echo >&2 "beads: database not initialized — skipping hook 'pre-commit'"
_bd_exit=0
fi
- if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
+ if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
fi
-# --- END BEADS INTEGRATION v1.0.3 ---
+# --- END BEADS INTEGRATION v1.3.2 ---
diff --git a/.beads/hooks/pre-push b/.beads/hooks/pre-push
index 5af9e7b..24796d1 100755
--- a/.beads/hooks/pre-push
+++ b/.beads/hooks/pre-push
@@ -1,24 +1,59 @@
#!/usr/bin/env sh
-# --- BEGIN BEADS INTEGRATION v1.0.3 ---
+# --- BEGIN BEADS INTEGRATION v1.3.2 ---
# This section is managed by beads. Do not remove these markers.
if command -v bd >/dev/null 2>&1; then
export BD_GIT_HOOK=1
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
- if command -v timeout >/dev/null 2>&1; then
- timeout "$_bd_timeout" bd hooks run pre-push "$@"
- _bd_exit=$?
- if [ $_bd_exit -eq 124 ]; then
- echo >&2 "beads: hook 'pre-push' timed out after ${_bd_timeout}s — continuing without beads"
+ case "$_bd_timeout" in
+ *[!0-9]*|'') _bd_timeout_invalid=1 ;;
+ *[1-9]*) _bd_timeout_invalid=0 ;;
+ *) _bd_timeout_invalid=1 ;;
+ esac
+ if [ "$_bd_timeout_invalid" -eq 1 ]; then
+ echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
+ _bd_timeout=300
+ fi
+ _bd_timeout_backend=none
+ _bd_timeout_command=
+ for _bd_timeout_candidate in timeout gtimeout; do
+ if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
+ if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
+ case "$_bd_timeout_version" in
+ "timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
+ esac
+ fi
+ fi
+ done
+ if [ -n "$_bd_timeout_command" ]; then
+ _bd_timeout_backend=coreutils
+ if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run pre-push "$@"; then
_bd_exit=0
+ else
+ _bd_exit=$?
+ fi
+ elif command -v perl >/dev/null 2>&1; then
+ _bd_timeout_backend=perl
+ if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run pre-push "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
fi
else
- bd hooks run pre-push "$@"
- _bd_exit=$?
+ echo >&2 "beads: hook 'pre-push' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
+ if bd hooks run pre-push "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
+ fi
fi
- if [ $_bd_exit -eq 3 ]; then
+ if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
+ echo >&2 "beads: hook 'pre-push' timed out after ${_bd_timeout}s — continuing without beads"
+ _bd_exit=0
+ fi
+ if [ "$_bd_exit" -eq 3 ]; then
echo >&2 "beads: database not initialized — skipping hook 'pre-push'"
_bd_exit=0
fi
- if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
+ if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
fi
-# --- END BEADS INTEGRATION v1.0.3 ---
+# --- END BEADS INTEGRATION v1.3.2 ---
diff --git a/.beads/hooks/prepare-commit-msg b/.beads/hooks/prepare-commit-msg
index f0aec3c..6c9e95b 100755
--- a/.beads/hooks/prepare-commit-msg
+++ b/.beads/hooks/prepare-commit-msg
@@ -1,24 +1,59 @@
#!/usr/bin/env sh
-# --- BEGIN BEADS INTEGRATION v1.0.3 ---
+# --- BEGIN BEADS INTEGRATION v1.3.2 ---
# This section is managed by beads. Do not remove these markers.
if command -v bd >/dev/null 2>&1; then
export BD_GIT_HOOK=1
_bd_timeout=${BEADS_HOOK_TIMEOUT:-300}
- if command -v timeout >/dev/null 2>&1; then
- timeout "$_bd_timeout" bd hooks run prepare-commit-msg "$@"
- _bd_exit=$?
- if [ $_bd_exit -eq 124 ]; then
- echo >&2 "beads: hook 'prepare-commit-msg' timed out after ${_bd_timeout}s — continuing without beads"
+ case "$_bd_timeout" in
+ *[!0-9]*|'') _bd_timeout_invalid=1 ;;
+ *[1-9]*) _bd_timeout_invalid=0 ;;
+ *) _bd_timeout_invalid=1 ;;
+ esac
+ if [ "$_bd_timeout_invalid" -eq 1 ]; then
+ echo >&2 "beads: invalid BEADS_HOOK_TIMEOUT; using 300 seconds"
+ _bd_timeout=300
+ fi
+ _bd_timeout_backend=none
+ _bd_timeout_command=
+ for _bd_timeout_candidate in timeout gtimeout; do
+ if command -v "$_bd_timeout_candidate" >/dev/null 2>&1; then
+ if _bd_timeout_version="$("$_bd_timeout_candidate" --version 2>/dev/null)"; then
+ case "$_bd_timeout_version" in
+ "timeout (GNU coreutils) "*) _bd_timeout_command=$_bd_timeout_candidate; break ;;
+ esac
+ fi
+ fi
+ done
+ if [ -n "$_bd_timeout_command" ]; then
+ _bd_timeout_backend=coreutils
+ if "$_bd_timeout_command" -- "$_bd_timeout" bd hooks run prepare-commit-msg "$@"; then
_bd_exit=0
+ else
+ _bd_exit=$?
+ fi
+ elif command -v perl >/dev/null 2>&1; then
+ _bd_timeout_backend=perl
+ if perl -e 'alarm shift; exec @ARGV' -- "$_bd_timeout" bd hooks run prepare-commit-msg "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
fi
else
- bd hooks run prepare-commit-msg "$@"
- _bd_exit=$?
+ echo >&2 "beads: hook 'prepare-commit-msg' running without timeout; install coreutils or perl to enable BEADS_HOOK_TIMEOUT"
+ if bd hooks run prepare-commit-msg "$@"; then
+ _bd_exit=0
+ else
+ _bd_exit=$?
+ fi
fi
- if [ $_bd_exit -eq 3 ]; then
+ if { [ "$_bd_timeout_backend" = coreutils ] && [ "$_bd_exit" -eq 124 ]; } || { [ "$_bd_timeout_backend" = perl ] && [ "$_bd_exit" -eq 142 ]; }; then
+ echo >&2 "beads: hook 'prepare-commit-msg' timed out after ${_bd_timeout}s — continuing without beads"
+ _bd_exit=0
+ fi
+ if [ "$_bd_exit" -eq 3 ]; then
echo >&2 "beads: database not initialized — skipping hook 'prepare-commit-msg'"
_bd_exit=0
fi
- if [ $_bd_exit -ne 0 ]; then exit $_bd_exit; fi
+ if [ "$_bd_exit" -ne 0 ]; then exit "$_bd_exit"; fi
fi
-# --- END BEADS INTEGRATION v1.0.3 ---
+# --- END BEADS INTEGRATION v1.3.2 ---
diff --git a/.gitignore b/.gitignore
index be530ef..179bc9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,6 +46,7 @@ CLAUDE.md
.dolt/
*.db
.beads-credential-key
+.beads.gate.lock
# --- babysitter managed ---
.a5c/creds.env
diff --git a/hosts/m3-hermes/services/t3code.nix b/hosts/m3-hermes/services/t3code.nix
index 32246fd..cd2b2c5 100644
--- a/hosts/m3-hermes/services/t3code.nix
+++ b/hosts/m3-hermes/services/t3code.nix
@@ -115,6 +115,7 @@ in {
pkgs.llm-agents.t3code
pkgs.llm-agents.opencode2
pkgs.llm-agents.claude-code
+ pkgs.llm-agents.beads
pkgs.agent-lib
];
@@ -144,15 +145,19 @@ in {
# Independent of HOME entirely: git uses exactly this ssh config
# (absolute store path) for every gitea remote.
GIT_SSH_COMMAND = "ssh -F ${t3SshConfig}";
+ # bd falls back to git's user.name for its audit trail, which would
+ # be m3tam3re here — keep it in line with the commit identity.
+ BEADS_ACTOR = gitIdentityEnv.GIT_AUTHOR_NAME;
}
// gitIdentityEnv;
- # Harness CLIs and git for the agents T3 Code spawns.
+ # Harness CLIs, git and the issue tracker for the agents T3 Code spawns.
path = with pkgs; [
git
openssh
llm-agents.opencode2
llm-agents.claude-code
+ llm-agents.beads
];
};
From d25015bc9d9bc00e6d0f3d0ab69efda44e8c3951 Mon Sep 17 00:00:00 2001
From: m3ta-chiron
Date: Sun, 1 Nov 2026 13:14:02 +0100
Subject: [PATCH 2/3] fix(t3code): run T3 agents as m3ta-chiron on every host
The identity lived in the m3-hermes service and in home-manager session
variables. Neither reaches the T3 desktop app on m3-kratos, so its agents
committed and pushed as m3tam3re. Wrap the T3 packages via an overlay so
everything T3 spawns inherits commit identity and Gitea push auth,
independent of host and launcher.
Co-Authored-By: Claude Opus 5.5
---
hosts/common/default.nix | 2 +
hosts/m3-hermes/services/t3code.nix | 44 +++++++-------------
overlays/default.nix | 64 +++++++++++++++++++++++++++++
3 files changed, 80 insertions(+), 30 deletions(-)
diff --git a/hosts/common/default.nix b/hosts/common/default.nix
index 8a6021d..8eebf0f 100644
--- a/hosts/common/default.nix
+++ b/hosts/common/default.nix
@@ -49,6 +49,8 @@
# with allowUnfree). Do NOT flatten to top-level attrs — see
# overlays/default.nix.
inputs.llm-agents.overlays.shared-nixpkgs
+ # Wraps pkgs.llm-agents.t3code* with the agents' m3ta-chiron identity.
+ outputs.overlays.t3code-agent-identity
# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
diff --git a/hosts/m3-hermes/services/t3code.nix b/hosts/m3-hermes/services/t3code.nix
index cd2b2c5..c57c7c7 100644
--- a/hosts/m3-hermes/services/t3code.nix
+++ b/hosts/m3-hermes/services/t3code.nix
@@ -16,12 +16,12 @@
# so no deploy token) into ~/.agents/skills + ~/.config/opencode/*. A
# path unit mirrors skills into ~/.claude/skills for Claude Code
# (port of m3ta-home profiles/sets/coding/agents/claude-skills.nix).
-# - Git identity: every harness spawned by `t3 serve` commits as the
-# m3ta-chiron bot account — via service env vars, deliberately NOT via
-# ~/.gitconfig, so m3tam3re's interactive git on this host is untouched.
+# - Git identity and Gitea push auth: m3ta-chiron for every harness spawned
+# by T3, baked into the package (overlays/default.nix,
+# t3code-agent-identity), so m3tam3re's interactive git is untouched.
# - Gitea SSH: m3tam3re's ssh config pins User gitea + key ~/.ssh/gitea
-# (one-time keygen; pubkey added to the m3ta-chiron account) — covers
-# git remotes AND git+ssh:// flake inputs. Host key pinned system-wide.
+# (one-time keygen; pubkey added to the m3ta-chiron account) for
+# interactive use and git+ssh:// flake inputs. Host key pinned system-wide.
#
# One-time interactive steps after deploy (deliberately NOT declarative —
# subscription auth must live in each harness's own credential store and
@@ -53,16 +53,6 @@
cockpitUser = "m3tam3re";
cockpitHome = "/home/${cockpitUser}";
- # Commit identity of the T3 Code agents: the fleet bot account. Env
- # vars are respected by git in every process the service spawns; they
- # survive restarts and stay out of m3tam3re's dotfiles.
- gitIdentityEnv = {
- GIT_AUTHOR_NAME = "m3ta-chiron";
- GIT_AUTHOR_EMAIL = "m3ta-chiron@agentmail.to";
- GIT_COMMITTER_NAME = "m3ta-chiron";
- GIT_COMMITTER_EMAIL = "m3ta-chiron@agentmail.to";
- };
-
# SSH to the private Gitea for the T3 lane. Sits in m3tam3re's ssh
# config (per-user — Hermes' own gitea access via its own ssh config
# is unaffected). URL-embedded users (gitea@code.m3ta.dev) match the
@@ -135,21 +125,13 @@ in {
RestartSec = "5";
};
- environment =
- {
- T3CODE_PORT = toString port;
- # Deterministic service context: HOME explicit so ssh/git resolve
- # ~ in every process this service spawns, however deep t3's
- # pty/sandbox chain resets the environment.
- HOME = cockpitHome;
- # Independent of HOME entirely: git uses exactly this ssh config
- # (absolute store path) for every gitea remote.
- GIT_SSH_COMMAND = "ssh -F ${t3SshConfig}";
- # bd falls back to git's user.name for its audit trail, which would
- # be m3tam3re here — keep it in line with the commit identity.
- BEADS_ACTOR = gitIdentityEnv.GIT_AUTHOR_NAME;
- }
- // gitIdentityEnv;
+ environment = {
+ T3CODE_PORT = toString port;
+ # Deterministic service context: HOME explicit so tools resolve ~ in
+ # every process this service spawns, however deep t3's pty/sandbox
+ # chain resets the environment.
+ HOME = cockpitHome;
+ };
# Harness CLIs, git and the issue tracker for the agents T3 Code spawns.
path = with pkgs; [
@@ -176,6 +158,8 @@ in {
systemd.tmpfiles.rules = [
"d ${cockpitHome}/.ssh 0700 ${cockpitUser} users -"
"L+ ${cockpitHome}/.ssh/config - - - - ${t3SshConfig}"
+ # The fleet-wide key path the T3 package expects (see t3code-agent-identity).
+ "L+ ${cockpitHome}/.ssh/m3ta-chiron - - - - ${cockpitHome}/.ssh/gitea"
];
# ── agent-lib v2 client: skills/commands/agents for the harnesses ────
diff --git a/overlays/default.nix b/overlays/default.nix
index df5e9c4..f2f8861 100644
--- a/overlays/default.nix
+++ b/overlays/default.nix
@@ -74,6 +74,70 @@
opencode-desktop = final.llm-agents.opencode2-desktop;
};
+ # T3 Code agents act as the m3ta-chiron bot on every host. Baked into the
+ # T3 packages rather than a session or service: everything T3 spawns
+ # inherits it, however T3 was launched (desktop launcher, systemd, shell),
+ # and any host installing T3 gets it. Must come AFTER shared-nixpkgs.
+ #
+ # Push auth needs ~/.ssh/m3ta-chiron on each host, with its pubkey on the
+ # m3ta-chiron Gitea account. A missing key fails the push instead of falling
+ # back to a personal key. Other hosts keep the user's own ssh config.
+ t3code-agent-identity = final: prev: let
+ identity = {
+ name = "m3ta-chiron";
+ email = "m3ta-chiron@agentmail.to";
+ };
+
+ giteaKnownHosts = final.writeText "gitea-known-hosts" ''
+ code.m3ta.dev ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFmmqZ4GgDEXJgj8uYrZAr/EoLIA6LJGkTIyKGQD/60a
+ '';
+
+ # ssh expands ~ from passwd, so this does not depend on $HOME.
+ sshConfig = final.writeText "t3-agent-ssh-config" ''
+ Host code.m3ta.dev
+ User gitea
+ IdentityFile ~/.ssh/m3ta-chiron
+ IdentitiesOnly yes
+ UserKnownHostsFile ${giteaKnownHosts}
+
+ # Conditional: IdentityFile accumulates across matching blocks, so a
+ # personal code.m3ta.dev entry must not be read for this host.
+ Host * !code.m3ta.dev
+ Include ~/.ssh/config
+ '';
+
+ wrapperArgs = final.lib.concatStringsSep " " (final.lib.mapAttrsToList (name: value: "--set ${name} ${final.lib.escapeShellArg value}") {
+ GIT_AUTHOR_NAME = identity.name;
+ GIT_AUTHOR_EMAIL = identity.email;
+ GIT_COMMITTER_NAME = identity.name;
+ GIT_COMMITTER_EMAIL = identity.email;
+ JJ_USER = identity.name;
+ JJ_EMAIL = identity.email;
+ # bd otherwise falls back to the user's git user.name for its audit trail.
+ BEADS_ACTOR = identity.name;
+ GIT_SSH_COMMAND = "${final.openssh}/bin/ssh -F ${sshConfig}";
+ });
+
+ wrapT3 = package:
+ final.symlinkJoin {
+ inherit (package) name meta passthru;
+ paths = [package];
+ nativeBuildInputs = [final.makeWrapper];
+ postBuild = ''
+ for program in $out/bin/*; do
+ wrapProgram "$program" ${wrapperArgs}
+ done
+ '';
+ };
+ in {
+ llm-agents =
+ prev.llm-agents
+ // {
+ t3code = wrapT3 prev.llm-agents.t3code;
+ t3code-desktop = wrapT3 prev.llm-agents.t3code-desktop;
+ };
+ };
+
# temp-packages = final: _prev: {
# temp = import inputs.nixpkgs-9e9486b {
# system = final.stdenv.hostPlatform.system;
From 5a66da916d9577900ccaf89867412c6c78e0a248 Mon Sep 17 00:00:00 2001
From: m3tam3re
Date: Sun, 1 Nov 2026 13:24:11 +0100
Subject: [PATCH 3/3] fix(t3code): recognize code.m3ta.dev as Gitea for change
requests
T3 only detects a Gitea on a custom domain through a matching tea or fj
login, so creating a change request failed with "No unknown source control
provider is registered". Put tea on T3's PATH with an m3ta-chiron login built
at runtime from the hermes-gitea-token agenix secret.
Co-Authored-By: Claude Opus 5.5
---
hosts/m3-hermes/secrets.nix | 4 ++++
hosts/m3-hermes/services/t3code.nix | 2 ++
hosts/m3-kratos/secrets.nix | 4 ++++
overlays/default.nix | 29 ++++++++++++++++++++++++++++-
4 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/hosts/m3-hermes/secrets.nix b/hosts/m3-hermes/secrets.nix
index 9a3b8d2..156d399 100644
--- a/hosts/m3-hermes/secrets.nix
+++ b/hosts/m3-hermes/secrets.nix
@@ -1,6 +1,10 @@
{
age = {
secrets = {
+ hermes-gitea-token = {
+ file = ../../secrets/hermes-gitea-token.age;
+ owner = "m3tam3re";
+ };
hermes-env = {
file = ../../secrets/hermes-env.age;
};
diff --git a/hosts/m3-hermes/services/t3code.nix b/hosts/m3-hermes/services/t3code.nix
index c57c7c7..c4915ba 100644
--- a/hosts/m3-hermes/services/t3code.nix
+++ b/hosts/m3-hermes/services/t3code.nix
@@ -22,6 +22,8 @@
# - Gitea SSH: m3tam3re's ssh config pins User gitea + key ~/.ssh/gitea
# (one-time keygen; pubkey added to the m3ta-chiron account) for
# interactive use and git+ssh:// flake inputs. Host key pinned system-wide.
+# - Gitea change requests: tea with the hermes-gitea-token agenix secret,
+# baked into the same package.
#
# One-time interactive steps after deploy (deliberately NOT declarative —
# subscription auth must live in each harness's own credential store and
diff --git a/hosts/m3-kratos/secrets.nix b/hosts/m3-kratos/secrets.nix
index 0ee16ad..3a580ff 100644
--- a/hosts/m3-kratos/secrets.nix
+++ b/hosts/m3-kratos/secrets.nix
@@ -1,6 +1,10 @@
{
age = {
secrets = {
+ hermes-gitea-token = {
+ file = ../../secrets/hermes-gitea-token.age;
+ owner = "m3tam3re";
+ };
anytype-key = {
file = ../../secrets/anytype-key.age;
owner = "m3tam3re";
diff --git a/overlays/default.nix b/overlays/default.nix
index f2f8861..cba45fd 100644
--- a/overlays/default.nix
+++ b/overlays/default.nix
@@ -82,6 +82,9 @@
# Push auth needs ~/.ssh/m3ta-chiron on each host, with its pubkey on the
# m3ta-chiron Gitea account. A missing key fails the push instead of falling
# back to a personal key. Other hosts keep the user's own ssh config.
+ #
+ # Change requests need the agenix secret hermes-gitea-token on each host,
+ # owned by the T3 user. Without it T3 cannot recognize code.m3ta.dev as Gitea.
t3code-agent-identity = final: prev: let
identity = {
name = "m3ta-chiron";
@@ -106,6 +109,30 @@
Include ~/.ssh/config
'';
+ # T3 only recognizes a Gitea on a custom domain through a matching tea
+ # login. The config lives in a private temp dir per call, so the token stays
+ # out of the nix store and a personal ~/.config/tea is left alone.
+ giteaTokenFile = "/run/agenix/hermes-gitea-token";
+ agentTea = final.writeShellApplication {
+ name = "tea";
+ text = ''
+ config="$(${final.coreutils}/bin/mktemp -d)"
+ trap '${final.coreutils}/bin/rm -rf "$config"' EXIT
+ ${final.coreutils}/bin/mkdir "$config/tea"
+ if [ -r ${giteaTokenFile} ]; then
+ ${final.coreutils}/bin/cat > "$config/tea/config.yml" <