03. Prompt Engineering
This document explores the structural prompting strategies, model routing, and context architecture that enable Omni-Post AI to generate highly technical, authentic content without the typical "AI Slop".
XML-Based Structured Prompting

Instead of few-shot prompting (expensive, inflexible), Omni-Post AI uses zero-shot prompting combined with a deeply structured XML context. This reduces input tokens while maximizing adherence to style and constraints.
Benefits:
- 50% fewer tokens vs. few-shot (lower cost, faster processing).
- Consistent voice across platforms (100+ personalization parameters).
- Easy to modify without rewriting prompts.
- Clear hierarchy for LLM parsing.
The Mega-Prompt Trap vs. Crisp Parameterization

The Initial Approach: When models with 1M+ token windows (like Gemini 3 Flash and 3.1 Pro) were integrated, the initial strategy was to leverage the massive context window by throwing everything into a single "Mega-Prompt". The combined user + system prompt spanned 350-400 lines, heavily laden with psychological storytelling rules, intricate behavioral constraints, and massive JSON payloads from the Personal Context and AI Content Strategist nodes.
The Failure: The assumption was: "More context = better output." The reality was the opposite.
- Hallucinations spiked: The model lost track of crucial details.
- Image tags vanished: Deterministic mechanical instructions (like inserting
<<IMAGE_1>>) were completely ignored. - Uncertain Quality: The drafts felt chaotic, and the LLM prioritized prose over specific, hard constraints.
The Fix (Crisp Parameterization): The Mega-Prompt was dismantled. Instead of a 400-line narrative prompt, instructions were heavily parameterized into crisp, modular XML blocks. We separated the Strategy phase from the Writing phase, giving each model a tiny, highly-focused prompt. By aggressively stripping out unnecessary context (e.g., removing the _fullSourceContent bloat), hallucination rates dropped to zero, and the system gained absolute certainty over the output quality.
The "ATC 04" Draft Comparison & NotebookLM Integration
To truly validate this transition, we conducted the "ATC 04 Comparison", where we systematically modified prompts and A/B tested the resulting drafts across all six platforms (Twitter/X, LinkedIn, Blog, Threads, Dev.to, and Hashnode).
The breakthrough came by integrating the NotebookLM CLI. We loaded high-quality notebooks containing advanced prompt engineering research, psychology frameworks, and content creation masterclasses into NotebookLM. By querying these expert notebooks, we iteratively refined our prompts. We measured the draft quality continuously until we achieved absolute "S-Tier" output that required zero human editing. The result was a dramatic trimming of our massive prompts into hyper-specialized, high-performance instructions.
AI Agent Node vs. Message a Model Node (The Tool Hallucination Problem)
A major architectural discovery during the ATC 04 testing was determining when to use the n8n AI Agent Node versus the standard Message a Model Node (Basic LLM).
Initially, the assumption was to give the AI Agent access to every tool (SerpAPI, Tavily Search, Think Tool) so it could intelligently draft content. This was a critical mistake. Providing too many tools to the writing nodes led directly to severe hallucinations. The model would get distracted by tool-calling logic rather than focusing on adhering to strict platform constraints (like character limits and image markers).
The S-Tier Routing Rule:
- AI Agent Node (Tool-Equipped): Used exclusively in the Research and Strategy phases (e.g., Market Intelligence). We strategically limit tools to only what is absolutely necessary (SerpAPI, Tavily search, Think tool) to enhance context without overwhelming the model.
- Message a Model Node (Toolless): Used exclusively for all Platform Writers (Twitter, LinkedIn, Blog, Threads, Dev.to, Hashnode). By stripping away tools and using the basic LLM node with our crisp parameterized prompts, the model focuses 100% on draft quality and constraint adherence, providing the absolute best output.
The 6-Point Reinforcement Pattern
See Developer Journal for full origin story of this pattern.
Sophisticated models (like Claude Sonnet 4.5) experience a "Capability-Compliance Gap" where they deprioritize simple mechanical tasks (like inserting <<IMAGE_1>> markers) when competing with complex creative rules.
Why this happens: Deterministic output requirements fail inside long creative prompts because the model's attention is consumed by narrative constraints, voice rules, and formatting logic. The Lesson: Stronger models are not automatically more compliant. They are more creative, which often makes them less reliable at strict formatting unless heavily constrained.
To solve this, any mandatory mechanical output requirement must appear in ALL 6 positions within the prompt:
- Think Tool / Pre-planning: Ask the model to declare the mechanical task explicitly.
- Simplified Rules: Keep it deterministic.
- Pre-output Verification Block: Remind the model immediately before output generation.
- Output Format JSON/Markdown Example: Show exactly how it should look.
- Validation Checklist Item: Ask the model to check itself.
- Final Instruction: Re-state the mechanical rule at the absolute end of the prompt.
The Career Engineer Framework (AI Strategy Engine)
The Insight: Most AI content generators produce generic output. They don't understand that LinkedIn content should attract job offers while Twitter content should earn developer respect.
The Solution: A two-phase AI pipeline that thinks like a career engineer:
Phase 1: AI Content Strategist
├─ Extracts "The Villain" (the specific problem/bug/bottleneck)
├─ Identifies "The Epiphany" (the moment the solution clicked)
├─ Creates platform-specific angles:
│ ├─ Twitter: "Alpha" angle (insider dev knowledge)
│ ├─ LinkedIn: "Money" angle (business value proposition)
│ ├─ Blog: "Authority" angle (definitive reference asset)
│ ├─ Threads: "Quick Win" angle (bite-sized, mobile-first takeaway)
│ ├─ Dev.to: "Community" angle (tutorial-style deep dive for devs)
│ └─ Hashnode: "Reference" angle (canonical long-form with subtitle)
└─ Generates image strategy with real vs. generative asset decisions
Phase 2: Platform Writers (Parallel Execution)
├─ Twitter: Punchy thread with 265-char hard limits per tweet
├─ LinkedIn: Result-first framework with Engineer's Humility
├─ Blog: SEO-optimized with AI Engine Discovery optimization
├─ Threads: ~500-char mobile-native posts (carousel support via container API)
├─ Dev.to: Markdown with frontmatter, Mermaid diagrams, and code highlighting
└─ Hashnode: Long-form markdown with dedicated subtitle field and canonical URLThe "Career Engineer" Philosophy:
- Don't just inform—build authority that attracts opportunities.
- Twitter = Dev respect | LinkedIn = Job offers | Blog = Portfolio depth.
- Every post must answer: "Why would someone hire me after reading this?"
Anti-Slop Guidelines (Strictly Enforced)
Zero-Cost Model Routing
The entire AI generation pipeline runs at $0/month through a personally maintained proxy infrastructure that provides access to premium models. Model selection is tiered by reasoning complexity:
| Tier | Model | Used For | Temp |
|---|---|---|---|
| Fast Filter | gemini-2.5-flash-lite | Data standardization, context filtering | 0 |
| High Volume | gemini-3-flash-preview | Twitter, Threads, Blog, Dev.to writers | 0.6–0.7 |
| Deep Reasoning | gemini-3.1-pro-preview | AI Content Strategist, LinkedIn writer | 0.4–0.5 |
| Specialist | gemini-3-pro-preview | Hashnode (long-form authority content) | 0.6 |
Design Principle: Assign the lightest model that can reliably complete each task. Reserve Pro-tier models strictly for nodes that require multi-step reasoning (strategy, narrative arc, business framing). This keeps the system well within free-tier API quotas across 5 rotated Google Cloud projects (~500 Pro RPD, ~7500 Flash RPD total).
Workflow Deep Dive: Context Merging & Contracts
1. The Append-Mode Merge Lesson
A critical architectural lesson emerged when the Code – Personal Context Builder timed out at 300 seconds. The root cause was poor cross-node data lookup patterns and heavy object serialization.
The Fix:
Merge - Wait Context Sourceswas configured to Append mode.- Instead of using slow
$('<Node>')lookups repeatedly, thePersonal Context Buildernow consumes merged inputs natively via$input.all(). - Contract: Prefer merged inputs over repeated cross-node references inside task-runner-sensitive Code nodes. Parse the smallest trustworthy payload slice possible. Do not
JSON.stringifylarge raw node objects unless there is no alternative.
2. Personal Context Builder Contract (v4)
The Context Builder node outputs a strict contract downstream, explicitly stripping out bloat to prevent timeout and context window explosion:
personalContext,voiceGuide,platformRules,contentPillars,sourceContent(single canonical copy),contentSummary,suggestedHooks.- NO
_fullSourceContentduplication. - NO
strategicContext.projectHooksorfutureRoadmap(handled strictly by Obsidian MCP context now).