Skip to content

feat(sharing): per-agent custom instructions for public & channel chats (#1205)#1337

Open
dolho wants to merge 1 commit into
devfrom
feature/1205-public-channel-prompt
Open

feat(sharing): per-agent custom instructions for public & channel chats (#1205)#1337
dolho wants to merge 1 commit into
devfrom
feature/1205-public-channel-prompt

Conversation

@dolho

@dolho dolho commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a per-agent Additional instructions field on the Sharing tab that injects a custom system-prompt fragment into public-facing conversations only — public links, channel chats (Slack/Telegram/WhatsApp), and x402 paid chat. Owners can tailor persona, scope limits, disclaimers, or guardrails for outside audiences without touching how the agent behaves in their own authenticated chats, scheduled work, or agent-to-agent calls. The text-surface counterpart of the existing voice_system_prompt.

Implementation (mirrors voice_system_prompt end-to-end)

Behavior guarantees

  • Strict no-op when unset — zero behavior change for existing agents.
  • A DB lookup failure degrades to the memory block alone — never blocks a chat.
  • Composes correctly with MEM-001 per-user memory (folded into the same caller_prompt).
  • Group chats: applied (group channels are public-facing) — per the AC default.

Acceptance criteria

  • New per-agent field editable from the Sharing tab, save/clear + char limit
  • Appended for public links, channel router, x402 paid chat
  • NOT applied to authenticated chat/session, schedules, loops, a2a
  • Composes with MEM-001 memory block in caller_prompt
  • Owner-only GET/PUT mirroring the voice-prompt pattern
  • Empty/unset is a strict no-op
  • Group-chat behavior explicit (applies to groups)

Testing

30 passed — new test_public_channel_prompt.py (db get/set/clear/isolation on SQLite + Postgres; helper composition: 4 combos + db-error degradation) plus the schema-parity and migrations suites green.

Related to #1205

🤖 Generated with Claude Code

…ts (#1205)

Owners can attach extra system-prompt instructions that apply to public-facing
conversations ONLY — public links, channel chats (Slack/Telegram/WhatsApp), and
x402 paid chat — without changing the agent's behavior in their own
authenticated chats, scheduled runs, loops, or agent-to-agent calls. The
text-surface counterpart of voice_system_prompt.

- schema/migration: agent_ownership.public_channel_system_prompt TEXT (schema.py
  + tables.py Core object + versioned migration, Invariant #3)
- db: get/set_public_channel_system_prompt (set strips, empty clears) + facade
  delegation
- models: PublicChannelPrompt / PublicChannelPromptUpdate (4000-char cap)
- api: owner-only GET/PUT /api/agents/{name}/public-prompt (sharing.py),
  mirroring the voice-prompt endpoints
- injection: platform_prompt_service.build_public_channel_caller_prompt folds the
  fragment with the MEM-001 memory block (public fragment first); wired into the
  three public-facing sites — message_router (channels), public.py (sync+async),
  paid.py (x402). Authenticated chat / schedules / loops / a2a never call it, so
  the scope exclusion holds by construction. Unset = strict no-op; a DB error
  degrades to the memory block (never blocks a chat)
- ui: Additional Instructions textarea (save/clear, char counter) in
  SharingPanel.vue via two agents-store methods
- tests: db get/set/clear/isolation + helper composition (4 combos + db-error
  degradation), SQLite + Postgres; schema-parity + migrations suites green
- docs: requirements section 44, architecture endpoint + column

Related to #1205

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dolho dolho requested a review from vybe June 24, 2026 11:20

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated via /validate-prtwo blockers (the prompt-injection framing, public/channel/x402 wiring, and tests look solid otherwise):

1. Missing Postgres/Alembic migration (Invariant #3). Adds agent_ownership.public_channel_system_prompt via a SQLite migration (_migrate_agent_ownership_public_channel_prompt) + schema.py/tables.py, but no Alembic revision under src/backend/migrations/versions/. PG deployments won't get the column. (schema-parity only guards the SQLite track — same gap as #1339.)

2. Conflicts with dev after #1317. #1317 restructured SharingPanel.vue (moved operator management to the new Access tab, reframed around Identity Proof / access policy). This PR was built on the old layout, so the SharingPanel.vue / routers/sharing.py conflicts need a rebase onto the redesigned component.

— posted via /validate-pr

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.

2 participants