feat: add chat projects with shared project memory (experiment) - #29242
Draft
f0ssel wants to merge 12 commits into
Draft
feat: add chat projects with shared project memory (experiment)#29242f0ssel wants to merge 12 commits into
f0ssel wants to merge 12 commits into
Conversation
…cts experiment Adds a lightweight chat_projects table and a nullable chats.project_id binding so agent chats can be grouped inside an organization-scoped project. Chats stay independent by default; deleting a project detaches its chats instead of deleting them. Backend: chat_project RBAC resource (org members read/create, creators and org admins update/delete), audited CRUD under /api/experimental/chats/projects, project_id on chat create/update and list filter, codersdk client methods. Frontend: experiment-gated Projects sidebar section with create/edit/ delete dialogs, /agents/projects/:projectId page, new-chat-in-project via ?project=, and a Move to project action in the chat menus.
Gives every chat in a project a durable, shared memory store modeled on
Claude Code's auto memory. Root chats in a project get a compact
<project-memory> index in the system prompt (guidance plus one line per
memory, capped at 200 lines / 25 KiB with an explicit truncation notice)
and read/save/delete tools that upsert by name. Memories carry a type
(user, feedback, project, reference), a one-line description, and a
markdown body, and are sanitized before storage.
After each completed root turn a detached, cursor-fenced extraction call
reviews the new transcript against the index and applies any upserts or
deletes the agent did not save itself. It never blocks the turn.
Adds the chat_project_memory RBAC resource (org members may read and
write), audited CRUD under /chats/projects/{project}/memories, and a
Memory section on the project page so users can inspect, edit, and
delete what the agent wrote. Gated by the chat-projects experiment.
…ation Exercises extractProjectMemories end to end against a mocked store and an intercepted model call: cursor fencing, transcript windowing by revision, normalization of upserts and deletes, the per-project cap, and that model failures leave the cursor untouched. Covers prepareGeneration placing the project memory index and tools only on root chats in a project with the experiment enabled.
Dogfooding with a small model surfaced three failure modes in the background extractor: it deleted a correct memory because the assistant said it did not know the fact, it re-recorded the assistant's restatement of existing memories as new ones, and it split facts the agent had just saved into duplicates. The extractor is now upsert-only and reads only new user messages, skips turns where the agent already used the memory tools, and the shared guidance tells the agent to check the index before claiming something is unknown and never to save unknowns.
A question-only turn led the extractor to rewrite a correct memory with hallucinated content. Existing memories are now updated only by the main agent's tool or the UI; extraction proposals that collide with an existing name are dropped.
…d type Memory rows now show only the name and type until expanded, where the description, body, and edit/delete actions appear. Manual creation is kept but demoted to a text button, since the agent is the expected writer. Also drops the story-only state prop in favor of seeded queries.
The dialog stayed mounted across edits, so its form state never picked up the selected memory. Remount it per memory.
Memories keep a name, one-line description, and body. The guidance still tells the agent what kinds of facts are worth saving, without asking it to categorize them.
Renumbers the chat projects migrations to 000595/000596 behind main's 000594_drop_task_tables and regenerates database and API artifacts.
Contributor
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warning
Experiment, work in progress. Everything is behind the
chat-projectsexperiment and off by default. Not ready for review; opening early for visibility and dogfooding.Adds projects: organization-scoped containers that group agent chats, plus project memory, a shared, agent-written memory store modeled on Claude Code's auto memory (index in the system prompt, read/save/delete tools, conservative post-turn extraction). Chats stay independent unless placed in a project.
Design notes and open questions live in the plan under
Phase 2; ARCHITECTURE.md has TODO markers where docs still need writing.Screenshots
Sidebar with projects

Project page: chats and memory

Memory expanded

Editing a memory

Chat reading project memory before answering

Move a chat to a project

Generated with Coder Agents on behalf of @f0ssel.