aaif-goose / aaif-goose/goose

Session portability: make sessions exportable, replayable, and fully deletable

未关闭
#10,951 0 条评论 0 个 reaction 已指派 1 人 已被 @lifeizhou-ap 认领 在 GitHub 查看
主要语言
Rust
星标
54.2k
派生
6.2k
平均合并
3 天 4 小时
30 天内合并 PR
240

描述

## Motivation

[This great article on session portability](https://earendil.com/posts/session-portability/) argues that an agent session is user data, and proposes five concrete tests for whether a tool treats it that way:

1. **Inspection** - can I read my session in a sane format?
2. **Export** - can I take a complete, self-contained copy elsewhere?
3. **Replay** - can I continue an exported session, including on a different provider?
4. **Audit** - can I tell which provider/model produced each message?
5. **Deletion** - when I delete a session, is it actually gone?

goose is closer to passing these than most agents (SQLite storage, `goose session export`, importers for Claude Code/Codex sessions), but each test has real gaps today:

- **Export is not self-contained.** The export is the bare session: subagent transcripts stay behind in the database, large tool outputs stay behind as pointers to local temp files that dangle on another machine, and provider settings are dropped on import.
- **Replay breaks across providers.** Replaying a transcript on a different provider can fail or misbehave because provider-bound state (thinking signatures, redacted thinking blocks, Gemini thought signatures) is sent back to a provider that never produced it.
- **Deletion is incomplete.** Deleting a session leaves its subagent child sessions (hidden `SubAgent` rows, invisible in session lists), their ledger rows, and spilled tool-output files on disk.
- **Audit is partial.** Inference metadata is not consistently recorded, so provenance of individual messages is not always answerable.

## Proposal

Three incremental changes, each independently useful:

1. **Record provenance, and scrub foreign provider-bound state at the replay boundary.** Record inference provenance (provider, requested model, resolved model) on every assistant message, which is what makes per-message audit answerable. Before a conversation is fixed up for a provider, use it to clear thinking signatures and drop redacted-thinking blocks on messages whose provenance does not match the target. Scrubbing at the boundary rather than in storage keeps the stored transcript a faithful record.
2. **Make exports a self-contained envelope.** Export bundles the session, its subagent descendants, and spilled tool outputs as content-addressed artifacts; import recreates the tree, rewrites pointers, and preserves provider settings. The envelope flattens the existing `Session` JSON so old exports import unchanged and old goose versions can still read new exports. This also implies making spill files session-owned (per-session directories under the data dir instead of flat OS temp files), which is what lets export prove ownership of a file before bundling it and lets deletion find it.
3. **Make deletion cascade.** Deleting a session removes the whole subagent subtree in one transaction, removes its spill directories, and garbage-collects imported artifact files that no remaining message references.

贡献指南

打开贡献指南

调研方向

该 issue 描述了对会话处理、导出和删除的更改。首先检查 SQLite 中的会话存储、`goose session export` 命令,以及 Claude Code/Codex 会话的导入器。查找子代理转录内容、工具输出和提供商设置的管理位置。理解推理溯源的数据流以及会话目录的结构是关键。'Done' 意味着导出内容是自包含的、跨提供商的回放可以正常工作,并且删除会完整地级联。

由索引模型根据 Issue 内容生成。

评估

技术栈
rust
领域
ai-infra-agents, backend-api-design
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
冷清
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。