Skip to main content

Module env

Module env 

Source
Expand description

Live environment - git context, cwd insights, OS-side observations the agent needs but the SDK doesn’t.

Distinct from userdata (on-disk Claude state) and cloud (network-side talk to api.anthropic.com): env is local-machine state about the project the user is working on right now.

Modules§

cli_version
Detect the installed claude CLI version and (when reachable) the latest published version on npm.
config_watch
A watch on exactly one file - forge.toml - so an edit reaches a running forge without a restart.
documents
The document read: one file from a session’s tree, bounded, as bytes with a kind.
file_index
File-index walker + filesystem watcher for the user’s project tree. Speaks the language of paths, ignore::WalkBuilder walks, and notify::Watcher events; produces typed snapshots and change batches without knowing anything about session routing.
git_command
The shared constructor every production git / gh spawn goes through.
git_diff
Git diff scanner - on-demand git subprocess invocations that produce a GitDiffSnapshot describing the project’s current changeset.
git_state
The working tree as a handoff brief reads it: branch, HEAD, the dirty paths and the diff’s stat.
lsp_path
Whether a declared LSP server binary resolves on PATH.
processes
OS-level process introspection for the Inspector pane’s PROCESSES section.
timezone
The host’s local IANA timezone, resolved dynamically, and the wall clock an RFC-3339 timestamp reads as in it. A generic OS-env probe shared by the usage scan’s day-bucketing, the SCHEDULES schedule formatter and the turn rows a view draws from a transcript.
token_usage
Token/cost accounting for the usage subject.
worktree
Git-worktree helpers for the worker spawn and despawn paths: detecting a repo, reading a worktree’s branch, deciding whether a worktree is safe to remove, removing it, and reaping the branch behind it.

Functions§

is_content_change 🔒
Whether an event kind can change a watched path’s content. A read cannot, and it matters: on inotify a read of a watched path is itself an event, so a watcher that reacts to one feeds itself.