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
fix(hermes): per-home sync cursors and profile attribution (#966)
claude[bot]4ab2555727d8
diff --git a/cli/beacon/cmd/endpoint_backfill.go b/cli/beacon/cmd/endpoint_backfill.goindex 9f6f8b6e..8a7d0c21 100644--- a/cli/beacon/cmd/endpoint_backfill.go+++ b/cli/beacon/cmd/endpoint_backfill.go@@ -115,7 +115,7 @@ var endpointBackfillRunners = func() []endpointBackfillRunner {return s.EventsEmitted, err}},{Name: "Hermes Agent", Sync: "beacon endpoint hermes sync", Run: func(r endpointBackfillRun) (int, error) {- s, err := hermessession.CollectOnce(hermessession.CollectOptions{Write: true, UserMode: r.UserMode, LogPath: r.LogPath, StatePath: resolveHermesStatePath("", r.UserMode), Since: r.Since, Budget: r.Budget})+ s, err := hermessession.CollectOnce(hermessession.CollectOptions{Write: true, UserMode: r.UserMode, LogPath: r.LogPath, StatePath: resolveHermesStatePath("", "", r.UserMode), LegacyStatePath: legacyHermesStatePath("", "", r.UserMode), Since: r.Since, Budget: r.Budget})return s.EventsEmitted, err}},{Name: "Devin CLI", Sync: "beacon endpoint devin sync", Run: func(r endpointBackfillRun) (int, error) {diff --git a/cli/beacon/cmd/endpoint_hermes.go b/cli/beacon/cmd/endpoint_hermes.goindex 062c3298..1f4457f5 100644--- a/cli/beacon/cmd/endpoint_hermes.go+++ b/cli/beacon/cmd/endpoint_hermes.go@@ -59,7 +59,7 @@ func init() {for _, c := range []*cobra.Command{endpointHermesSyncCmd, endpointHermesStatusCmd} {f := c.Flags()f.StringVar(&endpointHermesOpts.dbPath, "db", "", "Hermes state database (default $HERMES_HOME/state.db when set, otherwise the native Hermes data root)")- f.StringVar(&endpointHermesOpts.statePath, "state", "", "Collector cursor file (default ~/.beacon/endpoint/state/hermes.json)")+ f.StringVar(&endpointHermesOpts.statePath, "state", "", "Collector cursor file (default ~/.beacon/endpoint/state/hermes.json for the native Hermes root, hermes-<profile>-<id>.json for any other home)")f.BoolVar(&endpointOpts.jsonOutput, "json", false, "Print the result as JSON")f.BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")f.BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths")@@ -74,15 +74,17 @@ func init() {func runEndpointHermesSync(cmd *cobra.Command, args []string) error {userMode := endpointUserMode()+ dbPath := resolveHermesDBPath(endpointHermesOpts.dbPath)opts := hermessession.CollectOptions{- DBPath: endpointHermesOpts.dbPath,+ DBPath: dbPath,Print: endpointHermesOpts.print,Out: cmd.OutOrStdout(),Write: !endpointHermesOpts.print,UserMode: userMode,}if !endpointHermesOpts.print {- opts.StatePath = resolveHermesStatePath(endpointHermesOpts.statePath, userMode)+ opts.StatePath = resolveHermesStatePath(endpointHermesOpts.statePath, dbPath, userMode)+ opts.LegacyStatePath = legacyHermesStatePath(endpointHermesOpts.statePath, dbPath, userMode)opts.LogPath = lifecycle.ResolveRuntimeLog(userMode, endpointHermesOpts.logPath).EffectiveLogPath}@@ -148,11 +150,9 @@ type hermesStatusReport struct {}func runEndpointHermesStatus(cmd *cobra.Command, args []string) error {- dbPath := endpointHermesOpts.dbPath- if dbPath == "" {- dbPath = hermessession.DefaultDBPath()- }- statePath := resolveHermesStatePath(endpointHermesOpts.statePath, endpointUserMode())+ dbPath := resolveHermesDBPath(endpointHermesOpts.dbPath)+ statePath := resolveHermesStatePath(endpointHermesOpts.statePath, dbPath, endpointUserMode())+ legacyStatePath := legacyHermesStatePath(endpointHermesOpts.statePath, dbPath, endpointUserMode())report := hermesStatusReport{DBPath: dbPath, StatePath: statePath}store, err := hermessession.OpenStore(dbPath)@@ -167,7 +167,7 @@ func runEndpointHermesStatus(cmd *cobra.Command, args []string) error {defer store.Close()report.Present = true- state, err := hermessession.LoadState(statePath)+ state, err := hermessession.LoadStateSeeded(statePath, legacyStatePath)if err != nil {return err}@@ -218,18 +218,73 @@ func runEndpointHermesStatus(cmd *cobra.Command, args []string) error {return nil}+// resolveHermesDBPath fixes the database a command reads once, before anything is derived from it.+// The default is resolved here rather than per sweep, so a --watch that outlives `hermes profile use`+// keeps reading the store its cursor belongs to, and a relative --db is made absolute so the home,+// profile and cursor name come from the real directory rather than ".".+func resolveHermesDBPath(path string) string {+ if strings.TrimSpace(path) == "" {+ return hermessession.DefaultDBPath()+ }+ if abs, err := filepath.Abs(path); err == nil {+ return abs+ }+ return path+}+// resolveHermesStatePath keeps the cursor beside the log the sweep writes to. A system-mode sweep// collects on behalf of the machine, so its cursor belongs next to the system runtime log rather// than in whichever home the operator happened to run from; everything else uses the per-user-// default in hermessession.DefaultStatePath.-func resolveHermesStatePath(path string, userMode bool) string {+// default in hermessession.DefaultStatePath. Either default is keyed by the Hermes home dbPath is+// in, so syncing one profile or store never moves another's cursor.+func resolveHermesStatePath(path, dbPath string, userMode bool) string {if strings.TrimSpace(path) != "" {return path}- if !userMode {- if dir := filepath.Dir(lifecycle.ResolveRuntimeLog(false, "").EffectiveLogPath); dir != "" && dir != "." {- return filepath.Join(dir, "hermes-state.json")- }+ if dbPath == "" {+ dbPath = hermessession.DefaultDBPath()+ }+ hermesHome := filepath.Dir(dbPath)+ if dir := hermesSystemStateDir(userMode); dir != "" {+ return filepath.Join(dir, hermessession.StateFileName("hermes-state", hermesHome))+ }+ return hermessession.DefaultStatePath(hermesHome)+}++// legacyHermesStatePath is the unkeyed cursor a default sweep advanced before cursors were keyed by+// home: hermes.json, or hermes-state.json beside the system log. Every default sweep used it, so it+// belongs to whatever home DefaultDBPath() resolves to, which need not be the native root when+// HERMES_HOME or a sticky profile is set. It is empty for an explicit --state, for any other home,+// and when the keyed cursor already is the legacy file.+func legacyHermesStatePath(path, dbPath string, userMode bool) string {+ if strings.TrimSpace(path) != "" {+ return ""+ }+ if dbPath == "" {+ dbPath = hermessession.DefaultDBPath()+ }+ if !hermessession.SameHome(filepath.Dir(dbPath), filepath.Dir(hermessession.DefaultDBPath())) {+ return ""+ }+ keyed := resolveHermesStatePath("", dbPath, userMode)+ name := "hermes.json"+ if hermesSystemStateDir(userMode) != "" {+ name = "hermes-state.json"+ }+ if legacy := filepath.Join(filepath.Dir(keyed), name); legacy != keyed {+ return legacy+ }+ return ""+}++// hermesSystemStateDir is the directory beside the system runtime log that a system-mode sweep keeps+// its cursor in, or empty in user mode or when that log has no usable directory.+func hermesSystemStateDir(userMode bool) string {+ if userMode {+ return ""+ }+ if dir := filepath.Dir(lifecycle.ResolveRuntimeLog(false, "").EffectiveLogPath); dir != "" && dir != "." {+ return dir}- return hermessession.DefaultStatePath()+ return ""}diff --git a/cli/beacon/cmd/endpoint_hermes_test.go b/cli/beacon/cmd/endpoint_hermes_test.goindex e40a4b22..de141607 100644--- a/cli/beacon/cmd/endpoint_hermes_test.go+++ b/cli/beacon/cmd/endpoint_hermes_test.go@@ -1,9 +1,12 @@package cmdimport (+ "os""path/filepath""strings""testing"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/hermessession")// The cursor is what keeps a scheduled sweep from re-appending every Hermes session's whole@@ -11,23 +14,43 @@ import (// its cursor under the operator's home lets a later user-mode run skip sessions the user log never// received, and vice versa.func TestHermesStatePathFollowsTheSweepItBelongsTo(t *testing.T) {- if got := resolveHermesStatePath("/explicit/path.json", true); got != "/explicit/path.json" {+ if got := resolveHermesStatePath("/explicit/path.json", "", true); got != "/explicit/path.json" {t.Errorf("an explicit --state was overridden: %q", got)}- if got := resolveHermesStatePath("/explicit/path.json", false); got != "/explicit/path.json" {+ if got := resolveHermesStatePath("/explicit/path.json", "", false); got != "/explicit/path.json" {t.Errorf("an explicit --state was overridden in system mode: %q", got)}home := t.TempDir()t.Setenv("HOME", home)t.Setenv("USERPROFILE", home)+ t.Setenv("HERMES_HOME", "")- user := resolveHermesStatePath("", true)+ // The native root keeps the cursor file installs had before homes were keyed, however its+ // database is named.+ user := resolveHermesStatePath("", "", true)if want := filepath.Join(home, ".beacon", "endpoint", "state", "hermes.json"); user != want {t.Errorf("user cursor = %q, want %q", user, want)}+ if explicit := resolveHermesStatePath("", hermessession.DefaultDBPath(), true); explicit != user {+ t.Errorf("--db naming the native store moved its cursor to %q", explicit)+ }+ // Every other home gets its own cursor: a profile, a custom HERMES_HOME (the default profile of+ // its own root), and a same-named profile under that root.+ seen := map[string]string{user: "native root"}+ for _, dir := range []string{+ filepath.Join(home, ".hermes", "profiles", "work"),+ filepath.Join(home, "custom-hermes"),+ filepath.Join(home, "custom-hermes", "profiles", "work"),+ } {+ cursor := resolveHermesStatePath("", filepath.Join(dir, "state.db"), true)+ if other, ok := seen[cursor]; ok {+ t.Errorf("%s shares cursor %q with %s", dir, cursor, other)+ }+ seen[cursor] = dir+ }- system := resolveHermesStatePath("", false)+ system := resolveHermesStatePath("", "", false)if !filepath.IsAbs(system) {t.Errorf("system cursor = %q, which is not somewhere a sweep can reliably write", system)}@@ -38,3 +61,54 @@ func TestHermesStatePathFollowsTheSweepItBelongsTo(t *testing.T) {t.Errorf("system and user sweeps share one cursor at %q", system)}}++// The command fixes its database once: the default is not re-resolved per sweep, and a relative+// --db run from inside a profile names that profile's home rather than ".".+func TestHermesDBPathIsResolvedOnceAndAbsolute(t *testing.T) {+ home := t.TempDir()+ t.Setenv("HOME", home)+ t.Setenv("USERPROFILE", home)+ t.Setenv("HERMES_HOME", "")+ if got := resolveHermesDBPath(""); got != hermessession.DefaultDBPath() {+ t.Errorf("default db = %q, want %q", got, hermessession.DefaultDBPath())+ }+ work := filepath.Join(home, ".hermes", "profiles", "work")+ if err := os.MkdirAll(work, 0o755); err != nil {+ t.Fatal(err)+ }+ t.Chdir(work)+ got := resolveHermesDBPath("state.db")+ if !filepath.IsAbs(got) || hermessession.Profile(filepath.Dir(got)) != "work" {+ t.Errorf("relative --db resolved to %q, want an absolute path in the work profile", got)+ }+}++// Before cursors were keyed by home, every default sweep advanced hermes.json, including one whose+// default home was a custom HERMES_HOME. Its first keyed sweep starts from that cursor rather than+// re-emitting the history it already collected; another home never inherits it.+func TestHermesKeyedCursorSeedsFromTheLegacyCursor(t *testing.T) {+ home := t.TempDir()+ t.Setenv("HOME", home)+ t.Setenv("USERPROFILE", home)+ t.Setenv("HERMES_HOME", filepath.Join(home, "custom-hermes"))++ legacy := legacyHermesStatePath("", "", true)+ if want := filepath.Join(home, ".beacon", "endpoint", "state", "hermes.json"); legacy != want {+ t.Fatalf("legacy cursor = %q, want %q", legacy, want)+ }+ seed := &hermessession.State{Version: hermessession.StateVersion, Sessions: map[string]*hermessession.Cursor{"s1": {Started: true, LastMessageID: 7}}}+ if err := seed.Save(legacy); err != nil {+ t.Fatal(err)+ }+ keyed := resolveHermesStatePath("", "", true)+ state, err := hermessession.LoadStateSeeded(keyed, legacy)+ if err != nil {+ t.Fatal(err)+ }+ if c := state.Sessions["s1"]; c == nil || c.LastMessageID != 7 {+ t.Errorf("keyed cursor %q did not start from the legacy cursor: %+v", keyed, state.Sessions)+ }+ if other := legacyHermesStatePath("", filepath.Join(home, "elsewhere", "state.db"), true); other != "" {+ t.Errorf("a non-default home would inherit the legacy cursor %q", other)+ }+}diff --git a/cli/beacon/internal/endpoint/asymptote/metadata_fields_test.go b/cli/beacon/internal/endpoint/asymptote/metadata_fields_test.goindex 4be1bdd3..a36b2f7a 100644--- a/cli/beacon/internal/endpoint/asymptote/metadata_fields_test.go+++ b/cli/beacon/internal/endpoint/asymptote/metadata_fields_test.go@@ -51,7 +51,7 @@ var metadataOnlyKept = []string{"event.id", "event.kind", "event.action", "event.category", "event.fidelity","endpoint.hostname", "endpoint.os", "endpoint.agent_version","user.name", "user.uid",- "harness.name", "harness.version", "harness.executable_path", "harness.config_path", "harness.collection_method",+ "harness.name", "harness.version", "harness.executable_path", "harness.config_path", "harness.profile", "harness.collection_method","error.type","run.provider", "run.run_id", "run.run_attempt", "run.workflow", "run.job", "run.event_name","run.commit", "run.repository", "run.branch", "run.pr", "run.pr_number", "run.actor",diff --git a/cli/beacon/internal/endpoint/dashboard/events.go b/cli/beacon/internal/endpoint/dashboard/events.goindex 21621f6d..47754361 100644--- a/cli/beacon/internal/endpoint/dashboard/events.go+++ b/cli/beacon/internal/endpoint/dashboard/events.go@@ -907,6 +907,7 @@ func searchFields(record EventRecord) []string {event.Harness.Version,event.Harness.ExecutablePath,event.Harness.ConfigPath,+ event.Harness.Profile,event.Model,event.Repository,event.Branch,diff --git a/cli/beacon/internal/handoff/hermes_test.go b/cli/beacon/internal/handoff/hermes_test.goindex 9f31ecff..f27e1e0a 100644--- a/cli/beacon/internal/handoff/hermes_test.go+++ b/cli/beacon/internal/handoff/hermes_test.go@@ -230,7 +230,7 @@ func TestHermesSessionUsageInShares(t *testing.T) {if err != nil || !reflect.DeepEqual(again, events) {t.Errorf("repeated read changed events or identities: err=%v", err)}- if _, err := os.Stat(filepath.Dir(hermessession.DefaultStatePath())); !errors.Is(err, os.ErrNotExist) {+ if _, err := os.Stat(filepath.Dir(hermessession.DefaultStatePath(filepath.Dir(path)))); !errors.Is(err, os.ErrNotExist) {t.Errorf("reading a session created collection state: %v", err)}})diff --git a/cli/beacon/internal/hermessession/collect.go b/cli/beacon/internal/hermessession/collect.goindex cce8e9ce..20f89943 100644--- a/cli/beacon/internal/hermessession/collect.go+++ b/cli/beacon/internal/hermessession/collect.go@@ -63,6 +63,10 @@ type CollectOptions struct {// Budget, when set, caps the bytes this sweep may append. The sweep stops at the first event// that does not fit and returns writer.ErrBudgetSpent, with cursors past only what was written.Budget *writer.Budget+ // LegacyStatePath, when set, is the unkeyed cursor this home was advancing before cursors were+ // keyed by home. A sweep whose StatePath holds no sessions yet starts from it, so an upgrade does not+ // re-emit history that was already collected; the cursor is then saved to StatePath.+ LegacyStatePath string}type Summary struct {@@ -120,12 +124,39 @@ type MappedEvent struct {Event schema.Event}-func DefaultStatePath() string {+func DefaultStatePath(hermesHome string) string {base := filepath.Join(os.TempDir(), "beacon")if home, err := os.UserHomeDir(); err == nil && strings.TrimSpace(home) != "" {base = filepath.Join(home, ".beacon")}- return filepath.Join(base, "endpoint", "state", "hermes.json")+ return filepath.Join(base, "endpoint", "state", StateFileName("hermes", hermesHome))+}++// StateFileName names the cursor file for the Hermes home a sweep reads. The native root keeps the+// unkeyed name, so an existing install resumes from the cursor it already has. Every other home, a+// profile or a custom HERMES_HOME, gets a file named for its profile and keyed by its resolved path,+// so two homes never share a cursor even when both are the default profile of their own root or+// hold profiles of the same name.+func StateFileName(stem, hermesHome string) string {+ resolved := canonicalHome(hermesHome)+ userHome, _ := os.UserHomeDir()+ if root := nativeRoot(userHome); root != "" && canonicalHome(root) == resolved {+ return stem + ".json"+ }+ sum := sha256.Sum256([]byte(resolved))+ return fmt.Sprintf("%s-%s-%x.json", stem, Profile(hermesHome), sum[:6])+}++// LoadStateSeeded loads the cursor at path, or the one at legacy while path holds no sessions yet, as+// on the first sweep after cursors were keyed by home. Nothing is written: the caller's next Save+// puts the seeded cursor at path. Cursors are per session id, so a legacy entry for a session this+// home does not have is inert.+func LoadStateSeeded(path, legacy string) (*State, error) {+ state, err := LoadState(path)+ if err != nil || legacy == "" || legacy == path || len(state.Sessions) > 0 {+ return state, err+ }+ return LoadState(legacy)}func LoadState(path string) (*State, error) {@@ -204,7 +235,7 @@ func CollectOnce(opts CollectOptions) (summary Summary, err error) {}sessions = sessionwindow.Recent(sessions, opts.Since, func(r Session) int64 { return max(r.StartedAtMS, r.EndedAtMS, r.LastMessageAtMS) })summary.Sessions = len(sessions)- state, err := LoadState(opts.StatePath)+ state, err := LoadStateSeeded(opts.StatePath, opts.LegacyStatePath)if err != nil {return summary, err}@@ -247,6 +278,11 @@ func collectSession(store *Store, session Session, state *State, opts CollectOptreturn false, err}mapped, pending := MapSession(session, messages, cursor)+ home := filepath.Dir(store.Path())+ for i := range mapped {+ mapped[i].Event.Harness.ConfigPath = home+ mapped[i].Event.Harness.Profile = Profile(home)+ }if len(mapped) == 0 {cursor.PendingCalls = pendingadvanceCursorMessages(cursor, messages)diff --git a/cli/beacon/internal/hermessession/collect_test.go b/cli/beacon/internal/hermessession/collect_test.goindex 61887e19..945b9568 100644--- a/cli/beacon/internal/hermessession/collect_test.go+++ b/cli/beacon/internal/hermessession/collect_test.go@@ -11,6 +11,7 @@ import ("testing""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/schema"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/testenv")func TestCollectOnceMapsHermesStateDBAndAdvancesCursor(t *testing.T) {@@ -121,6 +122,33 @@ func TestMapSessionClassifiesFileTool(t *testing.T) {}}+// Both profiles hold the same session id, so a shared cursor would leave the second sync with+// nothing to write.+func TestCollectOnceKeepsHermesProfilesApart(t *testing.T) {+ home := t.TempDir()+ testenv.SetHome(t, home)+ root := filepath.Join(home, ".hermes")+ logPath := filepath.Join(home, "runtime.jsonl")+ want := map[string]string{"default": root, "work": filepath.Join(root, "profiles", "work")}+ for profile, dir := range want {+ if err := os.MkdirAll(dir, 0o755); err != nil {+ t.Fatal(err)+ }+ dbPath := filepath.Join(dir, "state.db")+ createHermesFixtureDB(t, dbPath)+ if _, err := CollectOnce(CollectOptions{DBPath: dbPath, StatePath: DefaultStatePath(dir), LogPath: logPath, Write: true, UserMode: true}); err != nil {+ t.Fatalf("sync %s: %v", profile, err)+ }+ }+ got := map[string]string{}+ for _, ev := range readEvents(t, logPath) {+ got[ev.Harness.Profile] = ev.Harness.ConfigPath+ }+ if len(got) != len(want) || got["default"] != want["default"] || got["work"] != want["work"] {+ t.Fatalf("profile -> config_path = %v, want %v", got, want)+ }+}+func createHermesFixtureDB(t *testing.T, path string) {t.Helper()db, err := sql.Open("sqlite", path)diff --git a/cli/beacon/internal/hermessession/home.go b/cli/beacon/internal/hermessession/home.goindex d2b43e25..f4924791 100644--- a/cli/beacon/internal/hermessession/home.go+++ b/cli/beacon/internal/hermessession/home.go@@ -121,6 +121,18 @@ func nativeRoot(home string) string {return filepath.Join(home, "."+name)}+// DefaultProfile is the name Hermes gives the profile whose home is the root itself.+const DefaultProfile = "default"++// Profile names the Hermes profile whose home is dir: <root>/profiles/<name> is <name>, and any+// other home is the default profile.+func Profile(dir string) string {+ if isProfileDir(dir) {+ return filepath.Base(dir)+ }+ return DefaultProfile+}+// isProfileDir is the launcher's test for a HERMES_HOME that already selects a profile: its parent// directory is named "profiles".func isProfileDir(path string) bool {@@ -149,6 +161,24 @@ func resolveExisting(path string) string {}}+// SameHome reports whether two Hermes home directories resolve to the same place.+func SameHome(a, b string) bool {+ return canonicalHome(a) == canonicalHome(b)+}++// canonicalHome is the form two spellings of one Hermes home share: absolute, with symlinks+// resolved, and case-folded on Windows, whose paths are case-insensitive.+func canonicalHome(dir string) string {+ if abs, err := filepath.Abs(dir); err == nil {+ dir = abs+ }+ dir = resolveExisting(dir)+ if runtime.GOOS == "windows" {+ dir = strings.ToLower(dir)+ }+ return dir+}+// activeProfile reads the sticky profile name from <root>/active_profile. A missing, unreadable or// empty file, or the name "default", selects no profile, as in Hermes.func activeProfile(root string) (string, bool) {diff --git a/docs/changelog/cli.mdx b/docs/changelog/cli.mdxindex 4316ddea..5a9a60a8 100644--- a/docs/changelog/cli.mdx+++ b/docs/changelog/cli.mdx@@ -17,6 +17,7 @@ Stay up to date with the latest changes to the Agent Beacon CLI.- **Session lenses show when a share is out of date** · A lens opened on a dashboard session page reported a shared session as `shared` after new work, while the trace lens and the session details showed it as stale, and it gave no refresh command. Session lenses now apply the same sharing state as the rest of the dashboard, including the `beacon share refresh` command.- **Shared Hermes sessions keep their token usage and cost** · `beacon share` of a Hermes Agent session read from its `state.db` left out the session's token usage and cost, so the shared trace showed none. They are now included, with Hermes's actual cost preferred over its estimate, as `beacon endpoint hermes sync` records them.- **Dashboard token totals honor the session filter** · With the dashboard's session-state filter set to captured, recurring or empty, the token view showed zero tokens and no events, and `all` or an unrecognized value hid everything. Token totals now cover the same sessions the event list shows for that filter.+- **Hermes sync keeps profiles apart** · Every Hermes home shared one sync cursor, so syncing a second profile or a custom `HERMES_HOME` on the same host could skip sessions the first sync had already passed. Each home now has its own cursor, and synced events record the home in `harness.config_path` and the profile in the new `harness.profile` field. The native `~/.hermes` root keeps its existing cursor, and the home a default sync resolves to (through `HERMES_HOME` or a sticky profile) starts its keyed cursor from the one it had been advancing, so neither re-emits history; any other home collects its retained history once more on its first sync.- **Dashboard output tokens count reasoning once** · The local dashboard's token view added reasoning tokens to output, but `gen_ai.usage.output_tokens` already includes them, so models that report reasoning had their output and total tokens overstated. Output and the total now count reasoning once, the split bar no longer shows reasoning as a separate segment, and a note below it gives the reasoning count included in output. `beacon token-usage` already counted it this way.---diff --git a/docs/runtimes/hermes-agent.mdx b/docs/runtimes/hermes-agent.mdxindex 8cf76691..f1d342ac 100644--- a/docs/runtimes/hermes-agent.mdx+++ b/docs/runtimes/hermes-agent.mdx@@ -76,7 +76,9 @@ The scheduled inventory job runs without your shell's environment, so a per-user`beacon endpoint hermes sync` reads committed rows from Hermes Agent's state database after Hermes has written them. Session status, sync, and handoff use the `state.db` in the [Hermes home directory](#hermes-home-and-profiles), following `HERMES_HOME` and a sticky profile. Pass `--db <path>` to status/sync or `--store-dir hermes=<path>` to handoff to select a database explicitly.-The cursor is stored in Beacon endpoint state and advances by session message id. Use `--print` to preview mapped events without writing the runtime log or advancing the cursor.+Synced events record the Hermes home they were read from in `harness.config_path` and its profile in `harness.profile`: the `<name>` of a `<root>/profiles/<name>` home, and `default` otherwise.++The cursor is stored in Beacon endpoint state and advances by session message id. Each Hermes home has its own cursor file, so syncing one profile or store never advances another's cursor: the native root (`~/.hermes`) keeps `hermes.json`, and any other home, a profile or a custom `HERMES_HOME`, uses `hermes-<profile>-<id>.json`, where `<id>` is derived from the home's path. The home a default sync resolves to starts its keyed cursor from `hermes.json`, which every default sync advanced before cursors were keyed, so upgrading does not re-collect it. Any other home starts with a new cursor the first time it is synced this way, so its retained history is collected once more. Use `--print` to preview mapped events without writing the runtime log or advancing the cursor.For scheduled collection, run `beacon endpoint hermes sync --watch`, or run one-shot `sync` from your scheduler. Live hooks remain the real-time path.diff --git a/docs/security/data-inventory.mdx b/docs/security/data-inventory.mdxindex 0d4498cc..12c9cf54 100644--- a/docs/security/data-inventory.mdx+++ b/docs/security/data-inventory.mdx@@ -111,7 +111,7 @@ skill preview/install do not call an evaluator.|--------|---------|---------------|| `endpoint` | Device and agent context | `hostname`, `os`, `agent_version` || `user` | Local operating system user context | `name`, `uid` |-| `harness` | Agent harness context | `name`, `version`, `executable_path`, `config_path` |+| `harness` | Agent harness context | `name`, `version`, `executable_path`, `config_path`, `profile` || `session` | Conversation or runtime session context | `id`, `working_directory` || `tool` | Tool invocation context | `name`, `command`, `path` || `file` | File activity context | `path`, `operation`, `language`, `diff_hash`, `diff_bytes` |diff --git a/docs/telemetry-schema/fields.mdx b/docs/telemetry-schema/fields.mdxindex 4d5cf596..856d8587 100644--- a/docs/telemetry-schema/fields.mdx+++ b/docs/telemetry-schema/fields.mdx@@ -13,7 +13,7 @@ Beacon models each event as an action plus a set of typed entities. The [`event`|--------|---------|---------------|| `endpoint` | Device and agent context for the machine where telemetry was collected | `hostname`, `os`, `agent_version` || `user` | Local operating system user context | `name`, `uid` |-| `harness` | Agent harness that produced the signal | `name`, `version`, `executable_path`, `config_path` |+| `harness` | Agent harness that produced the signal | `name`, `version`, `executable_path`, `config_path`, `profile` || `origin` | Event origin for local endpoint, cloud, or CI telemetry | `local`, `cloud`, `ci` || `run` | CI or ephemeral run context | `provider`, `run_id`, `run_attempt`, `workflow`, `job`, `event_name`, `commit`, `repository`, `branch`, `pr`, `pr_number`, `actor`, `ephemeral` || `session` | Conversation or runtime session context | `id`, `working_directory` |diff --git a/pkg/asymptoteobserve/event.go b/pkg/asymptoteobserve/event.goindex 4f49c0cb..f56ccfe2 100644--- a/pkg/asymptoteobserve/event.go+++ b/pkg/asymptoteobserve/event.go@@ -78,6 +78,9 @@ type HarnessInfo struct {Version string `json:"version,omitempty"`ExecutablePath string `json:"executable_path,omitempty"`ConfigPath string `json:"config_path,omitempty"`+ // Profile names the runtime profile the event came from, for runtimes that keep separate+ // configuration and state per profile on one host.+ Profile string `json:"profile,omitempty"`// CollectionMethod records the mechanism that carried this event off the runtime.// See the CollectionMethod* constants in provenance.go. Empty for events Beacon emits// about itself, which no harness collected.diff --git a/spec/threat-rules/FIELDS.md b/spec/threat-rules/FIELDS.mdindex 7d40464b..28b775ab 100644--- a/spec/threat-rules/FIELDS.md+++ b/spec/threat-rules/FIELDS.md@@ -96,6 +96,7 @@ Regenerate with `beacon rules fields --markdown > spec/threat-rules/FIELDS.md`.| `e.harness.config_path` | string || `e.harness.executable_path` | string || `e.harness.name` | string |+| `e.harness.profile` | string || `e.harness.version` | string || `e.health.component` | string || `e.health.reason` | string |