The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Leave Claude Code's state file out of the snapshot digest
shukieshah1c5fbdb5ab7f
diff --git a/cli/beacon/internal/endpoint/inventory/heartbeat.go b/cli/beacon/internal/endpoint/inventory/heartbeat.goindex 327b8ba1..38fab440 100644--- a/cli/beacon/internal/endpoint/inventory/heartbeat.go+++ b/cli/beacon/internal/endpoint/inventory/heartbeat.go@@ -169,7 +169,7 @@ func SnapshotDigest(result Result) string {Skills []Skill `json:"skills"`UserScope UserScope `json:"user_scope"`}{- Configs: existingConfigs(result.Configs),+ Configs: digestConfigs(existingConfigs(result.Configs)),MCPServers: result.MCPServers,Skills: existingSkills(result.Skills),UserScope: result.UserScope,@@ -182,6 +182,23 @@ func SnapshotDigest(result Result) string {return "sha256:" + hex.EncodeToString(sum[:])}+// digestConfigs strips the raw-file fingerprint from volatile runtime state files so the digest+// reflects inventory (which files exist, what they parse to, which MCP servers they declare) and+// not the runtime's own bookkeeping. ~/.claude.json is rewritten by Claude Code on every session;+// hashing it whole made every scheduled run a "changed" snapshot on a machine where nothing moved.+func digestConfigs(configs []Config) []Config {+ out := make([]Config, len(configs))+ for i, config := range configs {+ if config.Volatile {+ config.FileSHA256 = ""+ config.ModifiedAt = ""+ config.Content = nil+ }+ out[i] = config+ }+ return out+}+func existingConfigs(configs []Config) []Config {out := make([]Config, 0, len(configs))for _, config := range configs {diff --git a/cli/beacon/internal/endpoint/inventory/inventory.go b/cli/beacon/internal/endpoint/inventory/inventory.goindex 74b3b6be..1f6464ec 100644--- a/cli/beacon/internal/endpoint/inventory/inventory.go+++ b/cli/beacon/internal/endpoint/inventory/inventory.go@@ -92,18 +92,21 @@ type UserScope struct {}type Config struct {- Runtime string `json:"runtime"`- Path string `json:"path,omitempty"`- PathHash string `json:"path_hash,omitempty"`- Scope string `json:"scope"`- ConfigKind string `json:"config_kind"`- ParserMode string `json:"parser_mode"`- Exists bool `json:"exists"`- Readable bool `json:"readable"`- Reason string `json:"reason,omitempty"`- ParserStatus string `json:"parser_status"`- FileSHA256 string `json:"file_sha256,omitempty"`- ModifiedAt string `json:"modified_at,omitempty"`+ Runtime string `json:"runtime"`+ Path string `json:"path,omitempty"`+ PathHash string `json:"path_hash,omitempty"`+ Scope string `json:"scope"`+ ConfigKind string `json:"config_kind"`+ ParserMode string `json:"parser_mode"`+ Exists bool `json:"exists"`+ Readable bool `json:"readable"`+ Reason string `json:"reason,omitempty"`+ ParserStatus string `json:"parser_status"`+ FileSHA256 string `json:"file_sha256,omitempty"`+ ModifiedAt string `json:"modified_at,omitempty"`+ // Volatile is true for a runtime state file whose raw content changes on every session, so+ // the snapshot digest ignores its file hash and mtime; parsed MCP servers still count.+ Volatile bool `json:"volatile,omitempty"`MCPServerCount int `json:"mcp_server_count"`BeaconManaged bool `json:"beacon_managed"`Redaction string `json:"redaction"`@@ -137,6 +140,10 @@ type candidate struct {scope stringformat stringkind string+ // volatile marks a runtime state file the runtime itself rewrites constantly (session+ // bookkeeping, timestamps, project lists). Its raw content hash is reported but left out of+ // the snapshot digest; the MCP servers parsed from it carry their own definition hashes.+ volatile bool}func Scan(opts Options) Result {@@ -253,7 +260,7 @@ func candidates(home, wd string) []candidate {func claudeCandidates(home, wd string) []candidate {return []candidate{- {runtime: "claude_code", path: filepath.Join(home, ".claude.json"), scope: ScopeUser, format: formatJSON, kind: KindNativeConfig},+ {runtime: "claude_code", path: filepath.Join(home, ".claude.json"), scope: ScopeUser, format: formatJSON, kind: KindNativeConfig, volatile: true},{runtime: "claude_code", path: filepath.Join(home, ".claude", "settings.json"), scope: ScopeUser, format: formatJSON, kind: KindNativeConfig},{runtime: "claude_code", path: filepath.Join(wd, ".claude", "settings.json"), scope: ScopeProject, format: formatJSON, kind: KindNativeConfig},{runtime: "claude_code", path: "/Library/Application Support/ClaudeCode/managed-settings.json", scope: ScopeManaged, format: formatJSON, kind: KindManagedConfig},@@ -558,6 +565,7 @@ func shellProfilePath(home string) string {func inspectCandidate(item candidate, redaction string, co contentOptions) (Config, []MCPServer) {config := Config{+ Volatile: item.volatile,Runtime: item.runtime,Path: valueForPath(item.path, redaction),PathHash: hashString(item.path),diff --git a/cli/beacon/internal/endpoint/inventory/inventory_test.go b/cli/beacon/internal/endpoint/inventory/inventory_test.goindex 9acbeb25..416c2139 100644--- a/cli/beacon/internal/endpoint/inventory/inventory_test.go+++ b/cli/beacon/internal/endpoint/inventory/inventory_test.go@@ -1098,3 +1098,50 @@ func TestStateDigestFallsBackToTheLegacyFieldThenTracksPerHome(t *testing.T) {t.Fatal("WithDigest must not mutate its receiver")}}++// ~/.claude.json is Claude Code's state file and changes on every session. Its raw hash must not+// move the digest; the MCP servers parsed from it must.+func TestSnapshotDigestIgnoresVolatileStateFileChurn(t *testing.T) {+ home := t.TempDir()+ statePath := filepath.Join(home, ".claude.json")+ if err := os.WriteFile(statePath, []byte(`{"numStartups":1,"mcpServers":{"one":{"command":"npx"}}}`), 0o644); err != nil {+ t.Fatal(err)+ }+ first := Scan(Options{HomeDir: home, SkipProjectScope: true})+ if err := os.WriteFile(statePath, []byte(`{"numStartups":2,"lastSessionId":"abc","mcpServers":{"one":{"command":"npx"}}}`), 0o644); err != nil {+ t.Fatal(err)+ }+ second := Scan(Options{HomeDir: home, SkipProjectScope: true})+ if first.Configs[0].FileSHA256 == second.Configs[0].FileSHA256 {+ t.Fatal("test setup: the file hash should differ between scans")+ }+ if !second.Configs[0].Volatile {+ t.Fatal("~/.claude.json must be marked volatile")+ }+ if SnapshotDigest(first) != SnapshotDigest(second) {+ t.Fatal("bookkeeping churn in ~/.claude.json must not change the snapshot digest")+ }+ if err := os.WriteFile(statePath, []byte(`{"numStartups":3,"mcpServers":{"one":{"command":"npx"},"two":{"command":"uvx"}}}`), 0o644); err != nil {+ t.Fatal(err)+ }+ third := Scan(Options{HomeDir: home, SkipProjectScope: true})+ if SnapshotDigest(second) == SnapshotDigest(third) {+ t.Fatal("a new MCP server in ~/.claude.json must change the digest")+ }+ // A non-volatile config keeps its content in the digest.+ settings := filepath.Join(home, ".claude", "settings.json")+ if err := os.MkdirAll(filepath.Dir(settings), 0o755); err != nil {+ t.Fatal(err)+ }+ if err := os.WriteFile(settings, []byte(`{"hooks":{}}`), 0o644); err != nil {+ t.Fatal(err)+ }+ fourth := Scan(Options{HomeDir: home, SkipProjectScope: true})+ if err := os.WriteFile(settings, []byte(`{"hooks":{"Stop":[]}}`), 0o644); err != nil {+ t.Fatal(err)+ }+ fifth := Scan(Options{HomeDir: home, SkipProjectScope: true})+ if SnapshotDigest(fourth) == SnapshotDigest(fifth) {+ t.Fatal("an edit to settings.json must still change the digest")+ }+}diff --git a/docs/changelog/cli.mdx b/docs/changelog/cli.mdxindex 78438c95..c947a54e 100644--- a/docs/changelog/cli.mdx+++ b/docs/changelog/cli.mdx@@ -13,12 +13,15 @@ Stay up to date with the latest changes to the Agent Beacon CLI.### Unreleased-- **Scheduled inventory on shared Macs** · A system-mode heartbeat inventories whoever owns the- console. macOS service accounts (`_mbsetupuser` at the login window, home `/var/empty`) passed- that check and produced an empty snapshot, and on a Mac where two people alternate at the- console every switch wrote a "changed" snapshot although nobody's inventory changed. Service- accounts are now treated as no console user (heartbeat only, no snapshot), and the state file- remembers the last digest per home, so returning to an unchanged user writes a heartbeat only.+- **Scheduled inventory snapshots only on real change** · The first day of scheduled inventory+ showed every run writing a "changed" snapshot on machines where nothing had changed, because+ the digest hashed `~/.claude.json` whole and Claude Code rewrites that state file on every+ session. That file's raw hash is now left out of the digest (it is still reported); the MCP+ servers parsed from it keep their own hashes, so a real MCP change still snapshots. Two smaller+ fixes from the same data: a macOS service account holding the console at the login window+ (`_mbsetupuser`, home `/var/empty`) produced an empty snapshot and now counts as no console user+ (heartbeat only), and the state file keeps the last digest per home so a machine with more than+ one console user does not report a switch as a change.### v1.3.12 · September 15, 2026diff --git a/docs/cli/endpoint-inventory.mdx b/docs/cli/endpoint-inventory.mdxindex 960caab1..e40c23b2 100644--- a/docs/cli/endpoint-inventory.mdx+++ b/docs/cli/endpoint-inventory.mdx@@ -65,7 +65,7 @@ A scheduled local job appends inventory telemetry to a separate `inventory_state- `inventory.heartbeat` records that Beacon checked local agent configuration inventory, including counts and a snapshot digest. Every run writes one; it is the endpoint's liveness signal.- `inventory.snapshot` records the current metadata-only inventory. It is written only when the snapshot digest changed since the last run.-A system-mode job runs as root and inventories the active console user's home. When nobody is logged in, or the console is held by a macOS service account such as `_mbsetupuser` at the login window, it still writes the heartbeat, with `user_scope.mode` set to `no_console_user`, and no snapshot. On a Mac where several people share the console, the job keeps the last digest per home, so a switch between users is not reported as a change; each user's snapshot is written only when that user's inventory changed. The scheduled scan covers user-level configuration only; project-scoped files (`.cursor/mcp.json`, `.claude/settings.json` in a repository) are reported by `beacon endpoint inventory` run from that directory, not by the job.+A system-mode job runs as root and inventories the active console user's home. When nobody is logged in, or the console is held by a macOS service account such as `_mbsetupuser` at the login window, it still writes the heartbeat, with `user_scope.mode` set to `no_console_user`, and no snapshot. Runtime state files the runtime rewrites on every session (`~/.claude.json`) are reported with their hash but left out of the change digest, so `inventory.snapshot` is written when something inventory-relevant changed (a config, hook, skill, or MCP server), not on every Claude Code session. On a Mac with more than one console user the job keeps the last digest per home, so a switch between users is not reported as a change. The scheduled scan covers user-level configuration only; project-scoped files (`.cursor/mcp.json`, `.claude/settings.json` in a repository) are reported by `beacon endpoint inventory` run from that directory, not by the job.By default, inventory snapshots include config file metadata, MCP server metadata, skill metadata, and hook config metadata across supported local runtimes. They do not include skill instruction bodies, MCP secret values, full environment values, full command arguments, or unrelated config content.