Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hooks Configuration

All hook settings live under [hooks] in .bobbin/config.toml (local) or ~/.config/bobbin/config.toml (global).

Settings Reference

KeyTypeDefaultDescription
thresholdfloat0.5Minimum relevance score to include a result in injected context
budgetint300Maximum lines of injected context per prompt
content_modestring"full"Display mode: "full", "preview", or "none"
min_prompt_lengthint20Skip injection for prompts shorter than this (chars)
gate_thresholdfloat0.65Minimum top-result semantic similarity to inject at all
dedup_enabledbooltrueSkip re-injection when results match previous turn
show_docsbooltrueInclude documentation files in output (false = code only, docs still used for bridging)
format_modestring"standard"Output format: "standard", "minimal", "verbose", or "xml"
reducing_enabledbooltrueTrack injected chunks across turns; only inject new/changed chunks
repo_affinity_boostfloat2.0Score multiplier for files from the agent’s current repo. Set 1.0 to disable
feedback_prompt_intervalint5Prompt agents to rate injections every N injections. 0 = disabled
skip_prefixeslist[]Prompt prefixes that skip injection entirely (case-insensitive)
keyword_reposlist[]Keyword-triggered repo scoping rules (see below)

Gate Threshold vs Threshold

These are two different filters:

  • gate_threshold — Decides whether injection happens at all. Checks the top semantic search result’s raw similarity. Below this → skip the entire injection. This prevents bobbin from injecting irrelevant context when your prompt has nothing to do with the indexed code.

  • threshold — Once injection is triggered, this controls which individual results are included. Results scoring below this threshold are dropped from the injection.

Typical tuning: raise gate_threshold (e.g., 0.75) if you get too many injections on unrelated prompts. Lower threshold (e.g., 0.3) if you want more results per injection.

Skip Prefixes

Skip injection entirely for prompts that start with operational commands:

[hooks]
skip_prefixes = [
    "git ", "git push", "git pull", "git status",
    "bd ready", "bd list", "bd show", "bd close",
    "gt hook", "gt mail", "gt handoff", "gt prime",
    "cargo check", "cargo build", "cargo test",
    "go test", "go build", "go vet",
    "y", "n", "yes", "no", "ok", "done",
]

Matching is case-insensitive and prefix-based (the prompt is trimmed before matching). This prevents wasting tokens on context injection for commands where the agent just needs to run a tool, not understand code.

Keyword Repos

Route queries to specific repositories based on keywords. Without this, every query searches all indexed repos, which can return noisy cross-repo results.

[[hooks.keyword_repos]]
keywords = ["bobbin", "search index", "embedding", "context injection"]
repos = ["bobbin"]

[[hooks.keyword_repos]]
keywords = ["beads", "bd ", "issue tracking"]
repos = ["beads"]

[[hooks.keyword_repos]]
keywords = ["traefik", "reverse proxy", "TLS certificate"]
repos = ["aegis", "goldblum"]

[[hooks.keyword_repos]]
keywords = ["shanty", "tmux", "terminal"]
repos = ["shanty"]

When a prompt matches any keyword (case-insensitive substring), the search is scoped to the matched repos instead of searching all repos. Multiple rules can match — repos are deduplicated.

If no keywords match, the search falls back to all repos (default behavior).

Format Modes

ModeDescription
standardFile paths, chunk names, line ranges, and content. Default.
minimalFile paths and chunk names only. Lowest token cost.
verboseFull metadata including tags, scores, and match types.
xmlXML-structured output for agents that parse structured context.

Reducing (Delta Injection)

When reducing_enabled = true (default), bobbin tracks which chunks were injected in previous turns. On subsequent prompts, only new or changed chunks are injected — chunks already in the agent’s context are skipped.

This reduces token waste on multi-turn conversations about the same topic. Disable it (false) if you need every turn to get the full context (e.g., testing injection quality).

Repo Affinity

repo_affinity_boost gives a score multiplier to files from the agent’s current repository (detected from the working directory). Default 2.0 means results from the current repo score 2x higher than cross-repo results.

Set to 1.0 to treat all repos equally. Useful when you frequently need context from other projects.

Example: Multi-Agent Environment

For environments with many agents working across multiple repos:

[hooks]
threshold = 0.5
budget = 300
gate_threshold = 0.65
min_prompt_length = 20
dedup_enabled = true
reducing_enabled = true
repo_affinity_boost = 2.0
feedback_prompt_interval = 5

# Skip operational commands
skip_prefixes = [
    "git ", "bd ", "gt ",
    "cargo ", "go ", "npm ",
    "y", "n", "ok", "done",
]

# Route queries to relevant repos
[[hooks.keyword_repos]]
keywords = ["bobbin", "search", "embedding"]
repos = ["bobbin"]

[[hooks.keyword_repos]]
keywords = ["beads", "issue", "bead"]
repos = ["beads"]

[[hooks.keyword_repos]]
keywords = ["gas town", "gastown", "molecule", "polecat"]
repos = ["gastown"]