Skip to content

[enhance] custom system prompt per channel and group chat #171

Description

@mrgoonie

Context

Hiện system prompt/persona/rules của agent đang khá global. Với các channel hoặc group chat khác nhau, cùng một agent có thể cần hành vi khác nhau tuỳ ngữ cảnh: direct chat, group vận hành, group support, group sales, channel broadcast, community, v.v.

Problem

Không có cơ chế set custom system prompt riêng cho từng channel/group chat khiến agent khó thích nghi với từng môi trường:

  • Group nội bộ cần tone ngắn, task-oriented, có thể dùng memory/workflow nội bộ.
  • Group khách hàng cần tone cẩn trọng hơn, ít lộ thông tin nội bộ, không tự ý nhắc context riêng tư.
  • Channel broadcast cần format chuẩn, ít hội thoại.
  • Một agent tham gia nhiều nhóm nhưng mỗi nhóm có rule khác nhau.

Expected behavior

Cho phép cấu hình custom system prompt/rules theo từng channel và group chat, được merge an toàn với system prompt gốc của agent.

Proposed direction

  • Thêm config layer theo conversation/channel/group:
    • agent base prompt / identity / global policy
    • org/team policy
    • channel/group custom system prompt
    • runtime/task-specific prompt
  • Channel/group prompt chỉ được bổ sung hành vi, không được override safety/core policy.
  • UI cho admin/owner chỉnh prompt theo từng chat/channel.
  • Có preview prompt stack hoặc audit view để debug vì sao agent hành xử như vậy.
  • Có versioning/audit log cho thay đổi prompt.

Acceptance criteria

  • Owner/admin có thể set custom system prompt cho một channel hoặc group chat cụ thể.
  • Prompt đó chỉ áp dụng trong đúng channel/group tương ứng.
  • Prompt được merge với agent base prompt theo thứ tự rõ ràng, không bypass core/system/safety rules.
  • Có UI/API để xem, cập nhật, xoá custom prompt.
  • Có audit log/version history cho thay đổi prompt.
  • Có test cho direct chat, group chat, channel, và fallback khi không có custom prompt.

Security/privacy notes

  • Không cho channel/group prompt yêu cầu agent tiết lộ internal configs/secrets/memory riêng tư.
  • Cần phân quyền ai được chỉnh prompt theo chat/channel.
  • Cần hiển thị rõ prompt nào đang active để tránh cấu hình nhầm.

Open questions

  • Custom prompt nên gắn với chat ID, channel ID, workspace, hay org/team scope?
  • Có cần template prompt theo loại channel không?
  • Khi agent được add vào group mới, default behavior/prompt nên là gì?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions