claude-backup-banner prints a compact two-line status line summarizing the
current project, environment and backup health. It is safe to call from a shell
prompt, a status bar, or Claude Code — all detection degrades silently (missing
git, missing kubectl, missing backups never cause an error).
A healthy, recently-backed-up project:
(⎈ grapetrack|prod) → claude-code-backup
◐ backup: 2h ago · mcp: ok · config: ok
No backup yet (note the warning glyph and never):
(⎈ grapetrack|prod) → claude-code-backup
⚠ backup: never · mcp: ok · config: check
Reading the lines:
- Line 1 —
(⎈ <project>|<env>) → <directory> (<git-branch>)<project>: git repository name (or the directory name), or a fixedBANNER_PROJECT_NAME.<env>: detected environment (see below).<directory>: the current directory's name.(<git-branch>): appended when inside a git repo andBANNER_SHOW_GIT=true.
- Line 2 —
<glyph> backup: <age> · mcp: <ok|none> · config: <ok|check>- glyph is
◐normally,⚠when there is no backup or the latest backup is older thanBANNER_MAX_BACKUP_AGE_HOURS.
- glyph is
The banner reads $HOME/.claude-backup/banner.conf (override the path with the
CCB_BANNER_CONF environment variable). Start from
config/banner.example.conf. The file is
sourced as shell, so use KEY=value with no spaces around =.
| Key | Default | Meaning |
|---|---|---|
BANNER_ENABLED |
true |
Master switch; false prints nothing. |
BANNER_SHOW_GIT |
true |
Append the git branch to line 1. |
BANNER_SHOW_ENV |
true |
Show the ` |
BANNER_SHOW_BACKUP_STATUS |
true |
Show backup: <age> on line 2. |
BANNER_SHOW_MCP_STATUS |
true |
Show mcp: ok/none on line 2. |
BANNER_SHOW_SECRET_WARNING |
true |
Show config: ok/check on line 2. |
BANNER_STYLE |
compact |
Layout (only compact is implemented). |
BANNER_PROJECT_NAME_AUTO |
true |
Derive project name from git/dir. |
BANNER_PROJECT_NAME |
(empty) | Fixed name when …_AUTO=false. |
BANNER_ENV_AUTO |
true |
Auto-detect the environment. |
BANNER_ENV |
(empty) | Fixed environment when …_AUTO=false. |
BANNER_MAX_BACKUP_AGE_HOURS |
24 |
Age beyond which backups are flagged. |
When BANNER_ENV_AUTO=true, the environment is resolved in this order (first
hit wins), falling back to local:
$CLAUDE_ENV, then$ENV, then$APP_ENV, then$NODE_ENV- the current Kubernetes context name (only if
kubectlexists — never required; skipped silently otherwise) - the git branch name, if it contains
prod,stage/staging,devortrial - the current path, matched the same way
local
mcp: okwhen./.mcp.jsonexists in the current project or~/.claude.jsonexists; otherwisemcp: none.config: checkwhen any of./.mcp.json,./.claude/settings.local.jsonor~/.claude.jsonmatches the secret heuristic; otherwiseconfig: ok. The banner never prints the secret.
Run it once per prompt. For example, in bash (~/.bashrc):
# Print the banner above each prompt (only in interactive shells).
PROMPT_COMMAND='claude-backup-banner 2>/dev/null; '"${PROMPT_COMMAND:-}"In zsh (~/.zshrc):
precmd() { claude-backup-banner 2>/dev/null }Prefer it on demand instead? Just add an alias:
alias ccb-status='claude-backup-banner'There is no supported API for Claude Code to render arbitrary text in its own
prompt area, so the banner is exposed through the plugin's
/backup-status command, which runs claude-backup list and
claude-backup-banner and summarizes the result. If a future Claude Code
release adds a status-line/hook surface, the same claude-backup-banner output
can be wired into it unchanged.