Skip to content

feat(projects): suggestions from tool calls, with the desktop's rules and the daemon's folders - #934

Merged
OAraLabs merged 37 commits into
mainfrom
feat/chat-projects-suggestions
Nov 15, 2026
Merged

OAraLabs merged 37 commits into
mainfrom
feat/chat-projects-suggestions

Conversation

@OAraLabs

Copy link
Copy Markdown
Owner

Chat projects PR 5 (design #931, 3.6). Stacked on #933 (routes). Adds prometheus.projects.suggest (a port of Beacon's session-projects.ts rules) and GET /api/chat-project-suggestions (owner only, its own path so it can't match the chat-only /api/chat-projects/{project_id} pattern; route_access lists it as owner-only).

  • Rules (ported): home-directory paths only; ~/.prometheus/workspace/<x>; one container level; files directly in home/containers are not projects; OS folders and toolchains excluded; checkout suffixes fold; at least 3 project-touching calls, one folder with ≥60%, no tie; commonest spelling labels it.
  • Tests: every check in the desktop smoke's sections 2 and 3 (path rule and suggestion) as its own assertion, so desktop, phone and daemon answer alike.
  • The daemon's addition (design P12): a path inside a chat project's stored folder belongs to that project (key = id, label = name) and the projects root is a container; paths inside known folders or the root are found wherever they are on disk (a projects root need not be under home).
  • Route: the 200 most recently active unfiled conversations; machine sessions and chat-only devices' sessions left out; project = the existing project it would file into (by id, folder name or name). Cached per (session, newest rowid, projects rev); garbage content_json skipped.

Tests: tests/test_chat_projects_suggest.py (38), tests/test_chat_projects_suggest_route.py, red first. Gate clean; reference regenerated.

Review: one independent review.

🤖 Generated with Claude Code

OAraLabs and others added 21 commits November 13, 2026 23:20
…binding stays; root never followed or chmodded (review)

Writes run in a SAVEPOINT under a lock instead of the connection's
context manager, which committed or rolled back other work on the shared
connection; the tables are made with the conversation store's schema so
building the store commits nothing. Filing onto a folder the owner bound
by hand keeps that binding theirs. An existing projects root keeps its
mode and must be a plain directory owned by this user; the folder
returned is resolved. Forgetting a filed session raises rev; an import
key collision is its own error; names are NFC, stripped of control and
format characters, and casefolded.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and the daemon's folders

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ade, forgotten sessions not counted (reviews)

Folder checks compare file identity, never spelling: on a case-insensitive
disk a folder typed in another case no longer slips past home, the agent's
home (resolved, including the config and data dirs), the projects root,
another project's folder or a folder that contains home. The projects root
is checked (absolute, its existing parent valid, not under denied_paths)
before anything is made, and a null root means the default. A forgotten
session no longer counts in a project; instructions_rev hashes the whole
file off the event loop; a session bound before its first message cannot
be claimed after a restart; machine gateways and every error carry a kind;
a daemon without a store answers 404 (no projects).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed; store methods for existence and tool calls (review lows)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ched by folders, not rev (review)

Known-folder paths match only where a path segment ends and begins, so
/srv/app no longer matches /srv/application or /data/srv/app, and the
pattern is built once per tally. Suggestions read only assistant rows
that hold a tool call, and the cache key moves with the projects' ids,
names and folders, so filing a session no longer recomputes every other
one. Case ties pick the spelling the desktop picks; a checkout folder maps
to its project; folders compare without case on macOS; an owner lookup
that fails skips the row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@OAraLabs

Copy link
Copy Markdown
Owner Author

Review: one independent review, two rounds. Round 1: 2 medium (known-folder matches had no path boundary, so /srv/app matched /srv/application and /data/srv/app; heavy synchronous reads and a cache cleared by every filing), lows (case-tie label vs localeCompare, macOS case, checkout fold in the project mapping, session_owner errors); all fixed. A differential run against the TypeScript under node matched except the case tie, now fixed. Round 2: nothing medium or higher; the --flag=path low fixed. Left low: folding home-rule keys into a project's count before thresholding.

OAraLabs and others added 6 commits November 14, 2026 00:18
Regenerated with rebaseline-from-exchanges on ubuntu-24.04. Adds the empty
chat_projects, chat_projects_rev and session_chat_projects tables to every
scenario; the other moved lines are the title row's known order race and a
key moving inside an object, both compared order-free.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h its default

The store reads projects.root, so the template block and the inline
default belong here rather than in the routes PR. Same text as #933, so
the stack merges cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…utes

# Conflicts:
#	CHANGELOG.md
#	src/prometheus/memory/lcm_conversation_store.py
#	src/prometheus/projects/folders.py
#	src/prometheus/projects/store.py
…utes

# Conflicts:
#	CHANGELOG.md
#	docs/reference/routes.md
#	src/prometheus/web/route_access.py
#	src/prometheus/web/server.py
#	src/prometheus/web/ws_server.py
#	tests/test_route_access.py
@OAraLabs
OAraLabs changed the base branch from feat/chat-projects-routes to main November 15, 2026 02:44
OAraLabs and others added 3 commits November 14, 2026 21:44
…feat/chat-projects-suggestions

# Conflicts:
#	docs/reference/routes.md
…ggestions

# Conflicts:
#	CHANGELOG.md
#	docs/reference/routes.md
#	src/prometheus/web/chat_projects_routes.py
#	src/prometheus/web/route_access.py
@OAraLabs
OAraLabs enabled auto-merge (squash) November 15, 2026 02:46
@OAraLabs
OAraLabs merged commit 1dcb1af into main Nov 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant