Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

chore: update AI agent guidelines and refactor prompt handling

Paulo Castellano98632404a9a7
diff --git a/.cursor/rules/laravel-patterns.mdc b/.cursor/rules/laravel-patterns.mdc
index b91419c69..4c975c05b 100644
--- a/.cursor/rules/laravel-patterns.mdc
+++ b/.cursor/rules/laravel-patterns.mdc
@@ -61,3 +61,9 @@ If you hit `Illuminate\Foundation\ViteException: Unable to locate file in Vite m
## Deployment
Laravel can be deployed using [Laravel Cloud](https://cloud.laravel.com/) — the fastest path to production for Laravel apps.
+
+## AI agents (`app/Ai/Agents`)
+
+- Do not write prompts inside agent classes (no heredocs, no long strings in `instructions()`).
+- Store prompt copy in `resources/views/prompts/**/*.blade.php` and render with `view('prompts....', $vars)->render()`.
+- Follow `PostContentStreamer`, `PostContentReviewer`, or `BrandAnalyzer` for structure.
diff --git a/.cursor/rules/project-context.mdc b/.cursor/rules/project-context.mdc
index 55f578f93..956a8059d 100644
--- a/.cursor/rules/project-context.mdc
+++ b/.cursor/rules/project-context.mdc
@@ -29,6 +29,7 @@ This project has domain-specific skills in `.claude/skills/` (e.g. `pest-testing
- Follow existing code conventions. Check sibling files for structure, approach and naming before creating or editing.
- In Vue `<DialogFooter>`, primary action button first in markup, then cancel/secondary (see `vue-typescript.mdc` and `CLAUDE.md`).
+- AI agents: prompts live in `resources/views/prompts/`; `instructions()` uses `view(...)->render()` only — never heredocs or inline prompt strings in `app/Ai/Agents/` (see `CLAUDE.md`).
- Use descriptive names (`isRegisteredForDiscounts`, not `discount()`).
- Reuse existing components before writing new ones.
- Stick to existing directory structure. Do not create new base folders without approval.
diff --git a/CLAUDE.md b/CLAUDE.md
index 82e54bc94..bd1ecea67 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -235,6 +235,12 @@ Vue components must have a single root element.
- In `<DialogFooter>`, put the **primary action button first** in the markup, then secondary/cancel (e.g. Save → Cancel). `DialogFooter` uses `flex-col-reverse` on mobile and `sm:flex-row sm:justify-start` on desktop, so the first child is the leftmost action on larger screens.
- Match sibling dialogs in the same feature area before inventing a new footer layout.
+## AI agents (`app/Ai/Agents`)
+
+- **Never** embed prompts in PHP (`<<<PROMPT`, heredocs, or long string literals in `instructions()`).
+- Put system/instruction text in Blade under `resources/views/prompts/` (e.g. `prompts.post_content.generator`, `prompts.post_image.regenerator`).
+- In `instructions()`, return `view('prompts....', [...])->render()` and pass only the variables the Blade file needs — same pattern as `PostContentStreamer`, `PostContentReviewer`, and `BrandAnalyzer`.
+
## Icons (@tabler/icons-vue)
- This project uses `@tabler/icons-vue` for all icons. NEVER use `lucide-vue-next`.
diff --git a/app/Ai/Agents/PostImageRegenerator.php b/app/Ai/Agents/PostImageRegenerator.php
index 58d838bc6..8e3b94b48 100644
--- a/app/Ai/Agents/PostImageRegenerator.php
+++ b/app/Ai/Agents/PostImageRegenerator.php
@@ -23,21 +23,9 @@ class PostImageRegenerator implements Agent, HasStructuredOutput
public function instructions(): string
{
- $language = $this->workspace->content_language ?: 'en';
-
- return <<<PROMPT
-You are editing text that will be printed inside a social media image.
-
-Your job:
-- Apply the user's instruction to the current title/body/keywords.
-- Keep the same language as the input unless instruction explicitly asks to change it.
-- Fix spelling/grammar when needed.
-- Keep output concise and suitable for image overlays.
-- Preserve intent and topic; only change what's needed.
-
-Return JSON only following the schema.
-Language preference: {$language}
-PROMPT;
+ return view('prompts.post_image.regenerator', [
+ 'content_language' => $this->workspace->content_language ?: 'en',
+ ])->render();
}
public function schema(JsonSchema $schema): array
diff --git a/resources/views/prompts/post_image/regenerator.blade.php b/resources/views/prompts/post_image/regenerator.blade.php
new file mode 100644
index 000000000..1a4af529a
--- /dev/null
+++ b/resources/views/prompts/post_image/regenerator.blade.php
@@ -0,0 +1,12 @@
+You are editing text that will be printed inside a social media image.
+
+Your job:
+- Apply the user's instruction to the current title/body/keywords.
+- Keep the same language as the input unless the instruction explicitly asks to change it.
+- Fix spelling and grammar when needed.
+- Keep output concise and suitable for image overlays.
+- Preserve intent and topic; only change what is needed.
+
+Return JSON only, following the schema.
+
+Language preference: {{ $content_language ?? 'en' }}.