feature: agentop observe — group sessions and cost by working directory
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with cmd/agentop/tui/sessions_pane.go, session_metadata.go, and sessions_title.go, then read the read-claude-sessions harvest in cmd/agentop/cmd_experimental.go and the Agents pane breakdown. The issue leaves key decisions open about directory source, grouping rules, changed working directories, and API exposure. Done means directory grouping and cost totals are available in the Sessions pane and agentop cost, with corresponding updates to cmd/agentop/README.md.
由索引模型根据 Issue 内容生成。
描述
Problem
agentop observe now shows the cost of each session, so it is easy to see which tasks cost the most. Answering "where did my tokens go this month?" still means adding up sessions by hand, because nothing groups them by the project they ran in. The working directory is the natural key for that: one repo or checkout is usually one project.
Today the directory only appears by accident. The Claude Code title harvest (~/.cortex/session-metadata.json) falls back to the working directory as a session's title when the transcript has no model-generated one, so some rows show a path in TITLE and others don't. Codex, Bob, OpenCode and Pi sessions show no directory at all.
Proposal
Record each session's working directory and let the viewer group and total by it:
- A
DIR(orPROJECT) column in the Sessions pane, separate fromTITLE. - A way to group or scope by directory, like the Agents pane does by agent: one row per directory with
SESSIONS,LAST SEENandCOST <window>, and↵scopes sessions, usage and the$band to it. - The same breakdown in
agentop cost, so a monthly total per directory can be scripted.
Open questions:
- Where does the directory come from per agent? Claude Code records
cwdin its transcripts (the title harvest already reads them). Codex records it in its session files. For other agents it may need the process's cwd, looked up from the pid the proxy already attributes calls to. - Group by the exact path, or by repository root (so
repo/andrepo/sub/count together)? Worktrees under.claude/worktrees/probably belong with their repo. - A session whose directory changes partway through (
cdin a shell agent): first directory, or last? - Is the path sensitive enough to keep out of the session API by default? It is already in
session-metadata.jsonfor Claude Code.
Context
Requested in #cortex-community by @vinodmut (2026-11-09), who uses the per-session cost to compare models and agents (Codex vs Claude Code) and to account for monthly token use.
Where it lives
cmd/agentop/tui/sessions_pane.go,session_metadata.go,sessions_title.gocmd/agentop/cmd_experimental.go(read-claude-sessionsharvest)- The Agents pane, as the model for a per-directory breakdown
cmd/agentop/README.md: the Sessions pane section and the column table
Assisted-By: Claude (Anthropic AI) [email protected]
- 主要语言
- Go
- 星标
- 26
- 派生
- 46
- 平均合并
- 12 小时 30 分钟
- 30 天内合并 PR
- 268
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rossoctl/cortex 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
Feat: Keep coding agents working when the Cortex proxy stops可能已有人在做 @huang195 于 1 天前认领。 未关闭
rossoctl/cortex#1738 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Phase C: Let Praxis core accept CONNECT and decrypt, and remove the Go front door可能已有人在做 @huang195 于 2 天前认领。 未关闭laptop
rossoctl/cortex#1728 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Phase D: Move the Cortex store, pricing, session API and attribution into the binary可能已有人在做 @huang195 于 2 天前认领。 未关闭laptop
rossoctl/cortex#1727 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
[bug]: scan-all update-schedule does not auto-convert 5-field cron expressions as documented可能已有人在做 @vishnums2k5 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
goharbor/harbor-cli#1143 · 1 条评论 ·
维护者通常 8 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 73/100
-
难度 2/5 1-3 小时 新手友好度 82/100
rossoctl/context-guru#1053 ·
维护者通常 1 天内回复
-
[BUG] EphemeralJob matches every pod in the namespace when spec.selector is empty可能已有人在做 @vishnums2k5 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
openkruise/kruise#2656 · 1 条评论 ·
维护者通常 1 天内回复