From 2ff17686d049891007513926153f044ebb9d0c12 Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Thu, 25 Dec 2025 14:25:45 -0800 Subject: [PATCH] feat(prime): add no-git-ops config to disable git ops in session close (GH#593) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Users who want manual control over git commits can now set: bd config set no-git-ops true This makes `bd prime` output the stealth-mode session close protocol (just `bd sync --flush-only`) instead of the full git add/commit/push workflow. Useful when: - You want to verify work before committing - Claude tries to auto-commit after context compaction - You have a custom git workflow The --stealth flag still works as before for one-off use. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- cmd/bd/prime.go | 13 +++++++++++-- internal/config/yaml_config.go | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/bd/prime.go b/cmd/bd/prime.go index 0268e118..8fb2f2d9 100644 --- a/cmd/bd/prime.go +++ b/cmd/bd/prime.go @@ -31,7 +31,12 @@ Automatically detects if MCP server is active and adapts output: - CLI mode: Full command reference (~1-2k tokens) Designed for Claude Code hooks (SessionStart, PreCompact) to prevent -agents from forgetting bd workflow after context compaction.`, +agents from forgetting bd workflow after context compaction. + +Config options: +- no-git-ops: When true, outputs stealth mode (no git commands in session close protocol). + Set via: bd config set no-git-ops true + Useful when you want to control when commits happen manually.`, Run: func(cmd *cobra.Command, args []string) { // Find .beads/ directory (supports both database and JSONL-only mode) beadsDir := beads.FindBeadsDir() @@ -51,8 +56,12 @@ agents from forgetting bd workflow after context compaction.`, mcpMode = true } + // Check for stealth mode: flag OR config (GH#593) + // This allows users to disable git ops in session close protocol via config + stealthMode := primeStealthMode || config.GetBool("no-git-ops") + // Output workflow context (adaptive based on MCP and stealth mode) - if err := outputPrimeContext(os.Stdout, mcpMode, primeStealthMode); err != nil { + if err := outputPrimeContext(os.Stdout, mcpMode, stealthMode); err != nil { // Suppress all errors - silent exit with success // Never write to stderr (breaks Windows compatibility) os.Exit(0) diff --git a/internal/config/yaml_config.go b/internal/config/yaml_config.go index cda4f695..df473dd3 100644 --- a/internal/config/yaml_config.go +++ b/internal/config/yaml_config.go @@ -39,6 +39,7 @@ var YamlOnlyKeys = map[string]bool{ "git.author": true, "git.no-gpg-sign": true, "no-push": true, + "no-git-ops": true, // Disable git ops in bd prime session close protocol (GH#593) // Sync settings "sync-branch": true,