Why: Record the approved design for isolated no-project conversations.
Evidence: Design sections 1-4 approved 2026-10-22; task-start R0=a4311c63.
Impact: Docs only under docs/superpowers/{specs,plans}.
Refs: docs/superpowers/specs/2026-10-22-scratch-session-general-agent-design.md
Co-authored-by: Cursor <cursoragent@cursor.com>
62 lines
2.8 KiB
Markdown
62 lines
2.8 KiB
Markdown
# 无项目对话(Scratch Session)实施计划
|
||
|
||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||
|
||
**Goal:** 任意启用账号可创建彼此隔离的通用智能体会话;无 `project.create` 也能用;不得接入知识树/文档树等项目专属功能。
|
||
|
||
**Architecture:** 每个无项目对话 = 带 `settings.host.kind = "scratch"` 的私有空壳 `Project` + 恰好一条 `Conversation`。新建走专用 API(不要求 `project.create`)。列表/侧栏把 scratch 从真项目切换器剔除,归入虚拟分类「无项目对话」。服务端对 scratch 统一 fail-closed 拒绝 RDM/知识发布/成员等。
|
||
|
||
**Tech Stack:** Go Backend(store/server/authz)、TypeScript Frontend(store/TaskSidebar)、现有 SQLite projects 表 `settings` JSON。
|
||
|
||
**Spec:** [docs/superpowers/specs/2026-10-22-scratch-session-general-agent-design.md](../specs/2026-10-22-scratch-session-general-agent-design.md)
|
||
|
||
**实施执行:** agent-per-unit(配置:AGENT-EXECUTION.md);`fallback_to_host: never`。
|
||
|
||
## Global Constraints
|
||
|
||
- 固有能力不可做成 `role_permissions` 行。
|
||
- ListProjects 前后端一致过滤 scratch。
|
||
- RDM 未部署时也须宿主侧拒绝,不能只藏 UI。
|
||
- 最小充分:不做升级、协作、配额、nullable project_id。
|
||
|
||
## Review Focus
|
||
|
||
- 无 `project.create` 的创建路径与真项目门禁是否拆开
|
||
- scratch 上项目专属能力是否服务端 fail-closed
|
||
- 侧栏是否把 scratch 与真项目分开
|
||
|
||
## 文件映射
|
||
|
||
| 区域 | 路径 |
|
||
|------|------|
|
||
| 标记 helper | Backend store 或 core 小 helper |
|
||
| 创建 API | `modules/backend/internal/server/server.go` |
|
||
| 列表过滤 / 1:1 | `modules/backend/internal/store/projects.go`、server createConversation |
|
||
| 门禁 | `project_lifecycle.go`、cmdbus/RDM、knowledge、跨读 |
|
||
| 前端 API/store/侧栏 | `api.ts`、`store.ts`、`TaskSidebar.tsx` |
|
||
|
||
## Tasks
|
||
|
||
### U1 — Backend 创建与固有授权
|
||
|
||
- [ ] 实现 `IsScratchProject`;`POST /api/scratch-sessions`
|
||
- [ ] ListProjects 排除 scratch;禁止 POST /api/projects 伪造 scratch;scratch 下禁止二开会话
|
||
- [ ] 角色 catalog 不暴露可配置 scratch 动作
|
||
- [ ] 单测覆盖无/有 project.create、禁用账号、伪造、1:1
|
||
|
||
### U2 — Backend 项目专属 fail-closed
|
||
|
||
- [ ] `rejectIfScratch` 挂到 projectWork/成员/RDM/knowledge/X1/跨读
|
||
- [ ] 允许消息/附件/改名置顶归档/级联删除
|
||
- [ ] 单测正负例
|
||
|
||
### U3 — Frontend
|
||
|
||
- [ ] `createScratchSession`;sidebarMode;去掉无项目时自动「默认项目」
|
||
- [ ] TaskSidebar「无项目对话」分类与隐藏项目专属入口
|
||
- [ ] 前端测试
|
||
|
||
### U4 — 验证收口
|
||
|
||
- [ ] 最小相关测试通过;task-sync / PR / CI / 独立 Review
|