git:20260824.6fc2db3 to git:20260829.fe1ed86
20 added, 56 removed. Audit A to A.
# Status Line Handlers
- This directory contains all handlers for the `status_line` hook event type. These handlers generate the terminal status line displayed by Claude Code, showing model info, context usage, git branch, account details, and daemon health.
-
- **Architecture documentation**: See [CLAUDE/Architecture/StatusLine.md](/CLAUDE/Architecture/StatusLine.md) for the single source of truth on the status line system design, handler chain, output format, configuration, and how to add new elements.
-
- ## Handlers
-
- | File | Handler | Priority | Description |
- | -------------------------- | ----------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
- | `git_repo_name.py` | `GitRepoNameHandler` | 3 | Shows git repository name at start (cached for performance) |
- | `environment_indicator.py` | `EnvironmentIndicatorHandler` | 4 | Shows ๐ป desktop / ๐ณ docker / ๐ฆ podman / ๐ง lxc from the runtime `ProjectContext` cached at startup |
- | `account_display.py` | `AccountDisplayHandler` | 5 | Reads Claude account username from `~/.claude/.last-launch.conf` |
- | `model_context.py` | `ModelContextHandler` | 10 | Formats colour-coded model name (blue=Haiku, green=Sonnet, orange=Opus), 5-tier effort signal bars, and context percentage |
- | `git_branch.py` | `GitBranchHandler` | 20 | Shows current git branch name (๐ณ prefix + pink name when inside a linked worktree) |
- | `daemon_stats.py` | `DaemonStatsHandler` | 30 | Shows daemon uptime, memory usage, log level, and error count (developer diagnostics; OFF by default, on here as a dev-repo exception) |
- | `upgrade_notifier.py` | `UpgradeNotifierHandler` | 32 | Shows `๐ฆ vX โ vY` when a newer daemon version is available (ON by default; reads `version_check_cache.json`). Extracted from `daemon_stats.py` in Plan 00167 |
-
- > This table lists the core informational elements. Several more status handlers exist (`supervisor_indicator`, `multithread_indicator`, `current_time`, `working_directory`, `startup_cleanup`, `context_sidecar`, โฆ) โ see `.claude/HOOKS-DAEMON.md` for the full live-config list. The assembled line is **width-aware**: when Claude Code forwards the terminal width (`terminal_columns`, via the `init.sh` transport), `hook_result.py` wraps the segments onto multiple rows at `|` boundaries so nothing is lost on a narrow screen (Plan 00167).
-
- ## Thread Safety / Concurrency (FIRST-CLASS CONCERN)
-
- **Read this before adding or changing any status-line handler that touches a
- file or shared in-memory state.** Status-line code is inherently concurrent:
-
- - `handle()` runs on **every** status render, and **multiple Claude sessions
- can share one daemon** (Plan 00127) โ so shared on-disk files have concurrent
- readers/writers across processes.
- - Several files here are also written by the **ccy PTY supervisor**, a
- *separate* process (and its `--worker` subprocess) โ e.g. `context_sidecar`
- writes a sidecar the supervisor reads, and `supervisor_indicator` **reads**
- the transient message file the supervisor **writes** (rendering it attached to
- the top hat).
-
- Non-negotiable rules (already followed by `context_sidecar.py`,
- `thread_registry.py`, `supervisor_indicator.py` โ match them):
-
- 1. **Writes are atomic-replace only.** Write to a private temp file
- (`.{name}.{pid}[.{tid}].tmp`) then `os.replace()` (atomic on POSIX) โ never
- write a shared file in place. A reader then always sees a **complete** file,
- never a partial one; last writer wins. Skip stray `.*.tmp` files when
- scanning a directory (see `thread_registry.py`).
- 2. **Reads are fail-silent and defensive.** A missing / malformed / partial /
- foreign-schema file must yield "no segment", **never** raise โ a broken
- status line is worse than a missing element. Wrap `handle()` bodies so any
- unexpected error returns `AdvisoryResult(context=[])` (see `daemon_stats.py`,
- `supervisor_indicator.py`).
- 3. **In-memory caches are per-process and must tolerate concurrent peers.** A
- handler instance's caches (e.g. `supervisor_indicator`'s memoised pid) live
- in one daemon process; never assume you are the only writer of a shared
- *file*, and guard any state shared across threads with a `threading.Lock`.
+ Handlers for the `status_line` hook event: they assemble the terminal status
+ line Claude Code displays (model/context, git, environment, daemon health,
+ supervisor state).
- The paired writer-side guidance lives at the top of
- `.claude/ccy/claude-supervise.py` and in
- [CLAUDE/Architecture/StatusLine.md](/CLAUDE/Architecture/StatusLine.md).
+ **Canonical documentation**:
+ [CLAUDE/Architecture/StatusLine.md](/CLAUDE/Architecture/StatusLine.md) โ the
+ single source of truth for the system design, handler chain, output format,
+ width-aware wrapping, configuration, and how to add new elements. The live
+ per-project handler roster is generated into
+ [.claude/HOOKS-DAEMON.md](/.claude/HOOKS-DAEMON.md); do not maintain a
+ hand-written handler table here.
- ## Supporting Modules
+ ## Edit guard: concurrency is a FIRST-CLASS CONCERN
- | File | Description |
- | -------------------- | --------------------------------------------------------------------------------- |
- | `settings_reader.py` | mtime-cached reader for `~/.claude/settings.json` (used by `ModelContextHandler`) |
+ Status-line code is inherently concurrent (every render; multiple sessions
+ share one daemon; the ccy PTY supervisor writes/reads some of the same
+ files). BEFORE adding or changing any handler here that touches a file or
+ shared in-memory state, read and honour the three non-negotiable rules in
+ StatusLine.md's "Concurrency & Thread Safety" section โ atomic-replace
+ writes, fail-silent reads, lock-guarded shared state. `context_sidecar.py`,
+ `thread_registry.py` and `supervisor_indicator.py` are the conforming
+ references to mirror. The paired writer-side guidance sits at the top of
+ `.claude/ccy/claude-supervise.py`.