beads/docs/cli-reference/prime.md
Chris Sells cc9601f85c fix(cli): printed doc paths point at the new docs locations
Per decision 7, bd's user-facing strings now reference the Mintlify-era
paths: prime policy-profiles help, storage-backend comparison help
(store_factory_nocgo, init --backend), init-safety help (recovery
playbooks now docs/recovery/init-safety.md; the ADR reference now
engdocs/adr/), the pk-fork-refused recovery URL (dolt.go), doctor's plugin
suggestions (claude.go) and managed-handoff pointer, aider setup guidance
and the shared recipe template (quickstart URL), and the agent instruction
templates (sync-concepts URL, quickstart URL). bd mol pour's help no
longer claims molecules are 'synced with git' — they sync via Dolt like
any other bead.

Also corrects the stale claude recipe ProjectPath metadata
(.claude/settings.local.json -> .claude/settings.json; the dedicated
installer has written settings.json since the migration sweep).

This repo's AGENTS.md managed section is refreshed to the new template
body (hash bacef91e, has-remote variant preserved), and agents.md.tmpl's
embedded marker matches. Template tests updated to pin the new fragment;
CLI docs regenerated.

Recorded, not fixed (behavior-level, see the decision record):
routing.mode's maintainer/contributor no-op values and the
sync.require_confirmation_on_mass_delete key with no consumer.

Note: TestCheckBeadsRole_NotConfigured/_NotGitRepo in cmd/bd/doctor fail
on any machine with beads.role in the global git config (no HOME
isolation) — pre-existing, unrelated to this change.
2026-07-12 10:37:17 -07:00

2.9 KiB

title description
bd prime Output AI-optimized workflow context

{/* AUTO-GENERATED: do not edit manually */}

Generated from bd help --doc prime.

Output essential Beads workflow context in AI-optimized markdown format.

Automatically detects if MCP server is active and adapts output:

  • MCP mode: Brief workflow reminders (~50 tokens)
  • CLI mode: Full command reference (~1-2k tokens)

Designed for Claude Code, Gemini CLI, and Codex SessionStart hooks to prevent 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.

  • agent.profile: Explicit policy profile for git/commit authority wording (conservative | minimal | team-maintainer; default conservative). Set via: bd config set agent.profile team-maintainer Or per-session: BD_AGENT_PROFILE=team-maintainer (env var takes precedence). See docs/getting-started/ide-setup.md#policy-profiles for what each profile means.

    Workflow customization:

    • Place a .beads/PRIME.md file in the local clone or resolved workspace to override the default output entirely.
    • Use --export to dump the default content for customization.
    • Use --memories-only for hook contexts that should inject only persistent memories.

Memory injection caps: Large memory sets can exceed what a session-start hook host will ingest, and hosts truncate silently. Cap what prime injects with --max-memories N and/or --max-memory-chars N (or the prime.max-memories / prime.max-memory-chars config keys; an explicit flag wins, and an explicit 0 forces unlimited). Caps apply at whole-memory boundaries, at least one memory is always emitted, and a banner ahead of the entries reports how many were elided and how to browse the rest with bd memories. --max-memory-chars caps the total bytes of the injected memory entries; the section header and elision banner are excluded from the budget.

bd prime [flags]

Flags:

      --export                 Output default content (ignores PRIME.md override)
      --full                   Force full CLI output (ignore MCP detection)
      --hook-json              Wrap output in the SessionStart hook JSON envelope (Claude Code, Gemini CLI, Codex)
      --max-memories int       Cap injected persistent memories to N entries (0 = unlimited; falls back to the prime.max-memories config key)
      --max-memory-chars int   Cap the total bytes of injected memory entries, at whole-memory boundaries; section header and banner are not counted (0 = unlimited; falls back to the prime.max-memory-chars config key)
      --mcp                    Force MCP mode (minimal output)
      --memories-only          Output only persistent memories for compact hook contexts
      --stealth                Stealth mode (no git operations, flush only)