Saved Sonar prompts #35

Closed
opened 2026-03-11 12:16:22 +00:00 by project_1_bot_053fc026be1655bf3cd800152d0cdead · 3 comments
project_1_bot_053fc026be1655bf3cd800152d0cdead commented 2026-03-11 12:16:22 +00:00 (Migrated from gitlab.esvedra.one)

Overview

Allow users to save, name, and reuse Sonar prompts so they don't have to retype them on every call.

Proposed implementation

Storage

  • New MongoDB collection: user_prompts
  • Fields: user_id, name (encrypted with user DEK — same pattern as watchlists/portfolios), prompt_text (plaintext), prompt_type ("augmented" | "raw"), created_at, updated_at

API endpoints

  • GET /prompts — list saved prompts for the current user
  • POST /prompts — create a new saved prompt
  • GET /prompts/{pid} — get a single prompt
  • PUT /prompts/{pid} — update a saved prompt
  • DELETE /prompts/{pid} — delete a saved prompt

CLI commands

  • bodega prompts list
  • bodega prompts create --name "my macro scan" --type raw --text "What are the biggest macro risks this week?"
  • bodega prompts get <pid>
  • bodega prompts update <pid> --text "..."
  • bodega prompts delete <pid>

Integration with existing endpoints

Once implemented, /facts/sonar/augmented and /facts/sonar/raw should accept an optional prompt_id field in the request body. When provided, the saved prompt text is used instead of (or appended to) the context/prompt field.

  • Closes out the UX gap introduced in the "Externalize Sonar Prompts" change (issue #34)
  • Name encryption pattern: see src/database/repositories/watchlists.py
## Overview Allow users to save, name, and reuse Sonar prompts so they don't have to retype them on every call. ## Proposed implementation ### Storage - New MongoDB collection: `user_prompts` - Fields: `user_id`, `name` (encrypted with user DEK — same pattern as watchlists/portfolios), `prompt_text` (plaintext), `prompt_type` (\"augmented\" | \"raw\"), `created_at`, `updated_at` ### API endpoints - `GET /prompts` — list saved prompts for the current user - `POST /prompts` — create a new saved prompt - `GET /prompts/{pid}` — get a single prompt - `PUT /prompts/{pid}` — update a saved prompt - `DELETE /prompts/{pid}` — delete a saved prompt ### CLI commands - `bodega prompts list` - `bodega prompts create --name "my macro scan" --type raw --text "What are the biggest macro risks this week?"` - `bodega prompts get <pid>` - `bodega prompts update <pid> --text "..."` - `bodega prompts delete <pid>` ### Integration with existing endpoints Once implemented, `/facts/sonar/augmented` and `/facts/sonar/raw` should accept an optional `prompt_id` field in the request body. When provided, the saved prompt text is used instead of (or appended to) the `context`/`prompt` field. ## Related - Closes out the UX gap introduced in the "Externalize Sonar Prompts" change (issue #34) - Name encryption pattern: see `src/database/repositories/watchlists.py`
gertjan commented 2026-03-11 12:19:13 +00:00 (Migrated from gitlab.esvedra.one)

mentioned in commit c36fe91f21

mentioned in commit c36fe91f2119c7355fd87b569c4c2a90cc8fdb83
gertjan commented 2026-03-11 15:07:16 +00:00 (Migrated from gitlab.esvedra.one)

mentioned in commit 80d89ea5d1

mentioned in commit 80d89ea5d122188db17dee1389ec73b281f91a10
project_1_bot_053fc026be1655bf3cd800152d0cdead commented 2026-03-11 15:07:26 +00:00 (Migrated from gitlab.esvedra.one)

Implemented in commit 80d89ea. Full feature implementation:

Storage: MongoDB collection user_prompts with encrypted names
Private CRUD: All endpoints implemented (/prompts, /prompts/{pid}, etc.)
Public sharing: Mark prompts public with plaintext name copy (universe pattern)
Sonar integration: POST /facts/sonar/{augmented,raw} now accept prompt_id
CLI commands: bodega prompts list|create|get|update|delete|share|public-list|public-show
Sonar CLI: Updated with --prompt-id option for both augmented and raw queries

Version bumped to 0.17.9. See CHANGELOG and commits for full details.

Implemented in commit 80d89ea. Full feature implementation: ✅ Storage: MongoDB collection `user_prompts` with encrypted names ✅ Private CRUD: All endpoints implemented (/prompts, /prompts/{pid}, etc.) ✅ Public sharing: Mark prompts public with plaintext name copy (universe pattern) ✅ Sonar integration: POST /facts/sonar/{augmented,raw} now accept prompt_id ✅ CLI commands: bodega prompts list|create|get|update|delete|share|public-list|public-show ✅ Sonar CLI: Updated with --prompt-id option for both augmented and raw queries Version bumped to 0.17.9. See CHANGELOG and commits for full details.
project_1_bot_053fc026be1655bf3cd800152d0cdead (Migrated from gitlab.esvedra.one) closed this issue 2026-03-11 15:07:32 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
gertjan/bodega#35
No description provided.