Skip to content

feat: Project-Session mapping with stable Project Sessions and routing #582

Description

@yzxoi

User report

[需求 4] Project 与 Session 映射。定义 Clarus Project、Runtime Task、Synergy Session 和本地目录之间的关系。每个 Project 应有稳定的 Project Session 和 workspace;Runtime Task 可创建独立执行 Session。还需要明确普通消息、mention 和 task 的路由及唤醒策略,以及 Project 是否可以指定不同的 Primary Agent。

Reporter: Feishu:ou_25b44caac15ab235465df821bd7c8f2a
Source: feishu:oc_46d261becbf063b7e0b667667d210297; message:om_x100b6a7ac5d70c7cc42f17e2290d1c1

Triage

  • Type: feature_request
  • Target repo: SII-Holos/synergy
  • Related area: area/session

Deduplication

No duplicate found in recent open/closed issues. Issue #512 (Super Loop orchestration) and Issue #523 (Agent Organization Runtime) touch on multi-session orchestration but do not define the fundamental Project→Session mapping relationship. No existing issue defines the routing strategy for messages/mentions/tasks in the Clarus Project context.

Static inspection

  • packages/synergy/src/session/ — the session runtime system. Currently sessions are created per-conversation (via frontend, channel, or session_control tool) without a stable "Project Session" concept.
  • packages/synergy/src/session/inbox.ts — message inbox handling with agent name resolution via Agent.defaultAgent().
  • packages/synergy/src/session/input.ts — input routing based on agent name and channel type.
  • packages/synergy/src/task/ — task execution, which creates sub-sessions.
  • packages/synergy/src/tool/session-control.ts — session_control tool, which creates sessions with optional directory binding.
  • packages/synergy/src/runtime/reload.ts — runtime reload, includes default_agent watch.

Expected behavior

  1. Each Clarus Project should have a stable "Project Session" — a persistent session tied to the project lifecycle, not to individual user conversations.
  2. The Project Session has a dedicated workspace directory (see Issue 3).
  3. Runtime Tasks can create independent execution sessions (sub-sessions) distinct from the stable Project Session.
  4. Clear routing and wake-up strategy:
    • Normal messages in a project context → routed to Project Session
    • @mention of a specific agent → routed to that agent's session or sub-session
    • Task execution → creates independent sub-session in project workspace
  5. Projects should be able to specify a different Primary Agent (via default_agent override at project level).
  6. The mapping between entity types (Project, Runtime Task, Session, Directory) should be formally defined.

Actual behavior

  • No stable "Project Session" concept exists — sessions are created per interaction.
  • Routing is based on channel message metadata and agent mention, not on project membership.
  • No formal mapping between projects, tasks, sessions, and directories.

Proposed fix

  1. Define a data model for the Project→Session mapping, including:
    • ProjectSession — a persistent session associated with a Clarus Project
    • TaskSession — an execution sub-session created by a Runtime Task
    • Directory — the project workspace path
  2. Implement a Project Session lifecycle:
    • Created when the project is first accessed
    • Persists across user conversations
    • Tied to the project workspace directory
    • Stops when project is archived/deleted
  3. Define routing rules:
    • Messages in project scope → Project Session with project's assigned Primary Agent
    • @agent → route to that agent (sub-agent or primary)
    • Task tool → create TaskSession in project workspace
  4. Allow project-level default_agent override (new config field in project metadata).
  5. Document the formal entity relationship.

Suggested labels: enhancement, area/session

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Medium priorityarea/sessionSession runtime, inbox, stop/recoveryenhancementNew feature or requestneeds-triageNeeds maintainer or Oryn classification.oryn:kind: 💡 featureA proposed capability or behavior change.oryn:priority: 🟡 P2Normal-priority work.oryn:proof: 📝 not requiredLive behavior proof does not apply to this task.oryn:status: 🧭 needs inputA maintainer decision or additional information is required.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions