Skip to content

AtomCode v5.2.3 新子系统深度分析 — 后台会话(/bg)+ 异步 Agent 团队 + worklog/memory/changelog ​

基于 strings 模块路径 + 工具 schema 原文 + 事件埋点 + 类型表区的还原分析 2026-10-14 前置报告:06-version-diff-v5.0.9-to-v5.2.3.md 姊妹报告:DEEP_ANALYSIS_54(会话事件化)、DEEP_ANALYSIS_55(TUI 界面)


1. 后台会话(/bg、/background) ​

1.1 功能定位(版本自述原文) ​

- **Background sessions and teams**: /background (/bg) keeps the current session running
  in the background, grouped, switchable and retrievable; /review runs in the background
  by default; questions from background sessions come to the front to be answered in place;
  the team panel lists the main session, members and subagents with status, elapsed time
  and context use, and member sessions are saved and come back with their lead.

background sessions: bare, keep this one running in the background; with a task, start a
  new one on it; or list, switch to or drop them
Background sessions: /bg, /bg list, /bg `N`, /bg drop `N`
Compatibility alias: start a one-shot task in a /bg slot
Run a one-shot task in an isolated background context (read-only-ish tool subset)

⚠️ /bg / /background 命令族在 v5.0.9 已存在(basic 版),v5.2.3 大幅增强: 新增 /bg list、/bg N、`/bg drop `N、/bg tell、background.rs 运行时埋点、 TUI 后台面板插件行、background_only 配置项。

1.2 命令语法 ​

/bg              裸命令:把当前会话放后台
/bg `task`       带任务:新开后台会话
/bg list         列出后台会话
/bg `N`          切换到第 N 个
/bg drop `N`     丢弃第 N 个
/bg tell         对后台会话发送消息
/background      /bg 的兼容别名

1.3 生命周期证据 ​

阶段二进制证据
创建Your conversation moved to the background、(bg is /background)、this screen has no background panel
结果回落background result not delivered to the conversation that started it; it is still in /bg
/resume 双态a background session whose result came home is still offered in /resume / a background session taken up is still left out of /resume
恢复To resume the background session, run: ...
退出提示background sessions are still running ...
注入标签injected:background(与 injected:peer/reminder/memory/continuation/compactiontip 并列)
配置background_only(决定会话是否只允许后台运行)

1.4 模块 ​

crates/atomcode-cli/src/background.rs         ← 后台会话运行时(事件埋点 996/849/816)
crates/atomcode-cli/src/tui_bg.rs             ← /bg 命令 TUI 入口
crates/atomcode-tui/src/modules/bg.rs         ← 后台面板 UI
crates/atomcode-capabilities/src/tools/bash/background.rs  ← bash 后台作业

TUI 面板注册表插件行:id = "tui-panel-team"、tui-panel-rewind。


2. 异步 Agent 团队 ​

2.1 定位文档 ​

- **Agent Team**: several agents work in parallel, with each member's status, task
  details and token use shown live.
the team panel lists the main session, members and subagents with status, elapsed time
  and context use, and member sessions are saved and come back with their lead.

2.2 team 工具 schema(工具描述原文) ​

the `team` tool: named child agents with roles that stay, report back, and can be told more
team-in-process(插件名)
team runs named child agents that stay around: delegate with a role (...)

动作集:delegate / tell / stop / status

JSON 示例:

{"action":"delegate","name":"scout","role":"explorer",
 "task":"Find where sessions are created in crates/atomcode-harness/src and report file:line for each site."}

参数:

delegate needs name, role, task; tell needs name, text; stop takes name or none for all;
  status takes nothing
The member's name (delegate, tell, stop)
Run this member on a different model: a selection id from describe_self(aspect="models")
How hard this member should think, overriding the role's own level
The complete task (delegate)
For a role that writes: the files this member may change, as globs relative to the workspace
  (e.g. src/auth/**). Required unless members get checkouts of their own;
  two writers' scopes may not overlap.
What to tell the member (tell)  text is required

→ 写作用域 glob 非重叠;可指定成员模型(describe_self(aspect="models") 选择 id)。

2.3 角色文件(role file) ​

permission is required: explore (looks, changes nothing) or worker (may edit files and run commands)
difficulty is required: simple (the fast model) or hard (the strong one)
worker / permission / difficulty / simple / max_members / roles_dirs / worktrees / worktrees_dir
the lead has no tool catalog / a role file begins with ---
角色属性值含义
permissionexplore只读探查
permissionworker可编辑文件、运行命令
difficultysimple用快速模型
difficultyhard用强模型

2.4 并发上限配置 ​

[subagent] max_concurrent(默认 3)and max_rounds(默认 200)for delegated execution
[team] max_members(默认 6)limits the persistent roster, including idle members
codex / claude = off | read-only | accept-edits | auto
[[subagent.external]] entries(name, kind = codex | claude-code, model, permission,
  timeout_secs, enabled)

配置键:team.max_members(→ invalid_capacity)、subagent.max_concurrent、subagent.max_rounds、subagent.codex、subagent.claude。

2.5 类型表区 ​

struct MemberHeader with 8 elements
struct SessionHeader with 8 elements
struct TeamArgs with 8 elements
struct TeamRow / struct SubagentRow / struct SessionRow
struct ReplayCall with 2 elements / struct ReplayStep / struct ReplRow
struct PersistenceRow / struct RoundCapRow

2.6 模块 ​

crates/atomcode-coding/src/team_progress.rs
crates/atomcode-harness/src/plugins/team.rs
crates/atomcode-harness/src/plugins/agents.rs
crates/atomcode-harness/src/plugins/subagent.rs

移除(重构):crates/atomcode-coding/src/team/runner.rs、crates/atomcode-coding/src/team/tool.rs。

2.7 子代理任务结束状态机 ​

agent task cancelled or aborted:
agent task ended without a TurnComplete event / internal_error
agent task panicked:
delegated sessions poisoned / team runs poisoned

→ one-shot Agent 任务 panic / 异常取消 / 缺失回合终态返回明确内部错误。

2.8 委派边界 ​

a delegated agent never runs a shell, delegating, sensitive paths, writes outside its lane
refuse outright what a delegated agent may never do: a shell, delegating, sensitive paths,
  writes outside its lane
delegation-bounds(拒绝先于一切规则与询问)

3. /worklog(每日工作复盘) ​

3.1 命令定位 ​

Go through one day's sessions across all projects and turn them into a work report [today|yesterday|M/D]
Daily work recap across all projects (/worklog [today|yesterday|M/D])
Usage: /worklog [date]  (today / yesterday / 8/27 / 2026-08-27)

3.2 数据字段 ​

added_at / llm_call / remov / just now / Question
copy to Settings/worklog

→ 行记录字段:添加时间(added_at)、LLM 调用数(llm_call)、移除标记(remov)。

3.3 模块 ​

crates/atomcode-capabilities/src/session/worklog.rs

配套:recall 工具(list_sessions)—— A turn is indexed only AFTER it finishes (每轮结束才建索引,与事件追加模型自洽)。


4. /memory(三档记忆层) ​

4.1 分层 ​

global > project > local
GlobalProjectLocal / --global / --local / --project / Global:  Project: 
(memory is empty) / memory files: / memory: unknown scope '
three tiers, merged on the first turn of every session:

4.2 功能文档 ​

- **Read complete memories**: /memory shows full global, project and local memory in a
  reader with wrapping, scrolling and paging. Long workflows are no longer truncated by
  prompt budgets; model injection keeps its existing limits.
- **Sessions and memory**: a new list_sessions tool lists this project's past sessions;
  a new machine-local memory layer (global > project > local).

4.3 命令行 ​

Save a fact to memory (/remember --global for global)
Remove matching memories
Show all saved memories
/memory(可换行、滚动、翻页的阅读面板)
injected:memory(注入标签)

→ 模型注入仍保留原有预算限制;/memory 完整显示不截断。

4.4 模块变更 ​

移除:crates/atomcode-config/src/config/memory.rs、crates/atomcode-capabilities/src/memory/hook.rs。 记忆实现迁出 config/hook,改由 /memory 阅读器 + injected:memory 注入。


5. /changelog ​

5.1 入口 ​

Type /changelog for the full notes / /changelog / CHANGELOG.en.md
changelog / release notes / changelog-seen(已见标记)/ whats_new(配置键 ui.whats_new)
- A section has three parts under these subheadings (tabs in /changelog):

→ 升级后首次启动提示一行亮点;/changelog 面板分概览 + Issues 两个页签。

5.2 模块 ​

crates/atomcode-cli/src/tui_changelog.rs
crates/atomcode-config/src/changelog.rs

6. 模块路径总清单 ​

v5.2.3 新增:

crates/atomcode-capabilities/src/session/events.rs
crates/atomcode-capabilities/src/session/session_list.rs
crates/atomcode-capabilities/src/session/status_reminder.rs
crates/atomcode-capabilities/src/session/worklog.rs
crates/atomcode-capabilities/src/tools/bash/background.rs
crates/atomcode-coding/src/session_store.rs
crates/atomcode-coding/src/team_progress.rs
crates/atomcode-cli/src/background.rs
crates/atomcode-cli/src/tui_bg.rs
crates/atomcode-cli/src/tui_changelog.rs
crates/atomcode-tui/src/modules/bg.rs
crates/atomcode-harness/src/plugins/agents.rs
crates/atomcode-harness/src/plugins/team.rs
crates/atomcode-harness/src/plugins/subagent.rs
crates/atomcode-harness/src/plugins/session.rs
crates/atomcode-harness/src/plugins/recall.rs
crates/atomcode-config/src/changelog.rs

v5.0.9 移除(重构):

crates/atomcode-capabilities/src/session/transcript.rs   # → events.rs
crates/atomcode-capabilities/src/memory/hook.rs          # → /memory 阅读器
crates/atomcode-coding/src/team/runner.rs                # → plugins/team.rs
crates/atomcode-coding/src/team/tool.rs
crates/atomcode-config/src/config/memory.rs

7. 结论 ​

  1. 后台会话增强:/bg 从 basic 版扩展为全套命令(list/N/drop/tell), 结果回落 + /resume 双态管理 + background_only 配置
  2. Agent 团队产品化:team 工具 4 动作 + 角色文件(permission/difficulty)+ 写作用域 glob 非重叠 + 并发上限(max_concurrent=3 / max_members=6)
  3. 会话随团队恢复:member sessions are saved and come back with their lead
  4. worklog/memory/changelog:三档记忆 + 完整阅读器;跨项目日复盘;版本日志面板

基于 VitePress 构建 · AtomCode v5.2.3 逆向工程分析文档