From a2d226583fedb7bbc86868e202fcb4badb0c1352 Mon Sep 17 00:00:00 2001
From: m3tam3re
Date: Sun, 1 Nov 2026 13:09:34 +0100
Subject: [PATCH] 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
];
};