<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: OpsJarvis · Caelara Labs</title>
    <description>The latest articles on DEV Community by OpsJarvis · Caelara Labs (@opsjarvisai).</description>
    <link>https://dev.to/opsjarvisai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4246419%2F095e5a1b-cff8-443f-930a-b613ee5d63b4.jpg</url>
      <title>DEV Community: OpsJarvis · Caelara Labs</title>
      <link>https://dev.to/opsjarvisai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/opsjarvisai"/>
    <language>en</language>
    <item>
      <title>How I Built a Self-Hosted AI Operations Desk With Claude, Next.js 15 &amp; Human Approval Gates</title>
      <dc:creator>OpsJarvis · Caelara Labs</dc:creator>
      <pubDate>Sun, 15 Nov 2026 18:47:45 +0000</pubDate>
      <link>https://dev.to/opsjarvisai/how-i-built-a-self-hosted-ai-operations-desk-with-claude-nextjs-15-human-approval-gates-3lj6</link>
      <guid>https://dev.to/opsjarvisai/how-i-built-a-self-hosted-ai-operations-desk-with-claude-nextjs-15-human-approval-gates-3lj6</guid>
      <description>&lt;p&gt;Small B2B teams lose about an hour a day to the same loop: scan the inbox, scan Slack, work out what is urgent, update the CRM, repeat. Most "AI agent" demos solve this by letting a model act freely and printing "done". That is exactly the part that scares operators, and rightly so: a wrong refund or a wrong CRM stage change is a real cost.&lt;/p&gt;

&lt;p&gt;OpsJarvis is my answer to that: a &lt;strong&gt;self-hosted operations desk&lt;/strong&gt; where Claude does all the reading, classifying and drafting, and a &lt;strong&gt;human approves every write&lt;/strong&gt;, with the real payload on screen. It is open-core under MIT; the live sandbox needs no login: &lt;a href="https://caelaralabs.com" rel="noopener noreferrer"&gt;https://caelaralabs.com&lt;/a&gt;. Source: &lt;a href="https://github.com/kingefman1-cmyk/opsjarvis" rel="noopener noreferrer"&gt;https://github.com/kingefman1-cmyk/opsjarvis&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This post is the technical teardown: architecture, the approval gate, the circuit breaker, the injection hardening, and what I would do differently.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one-sentence design rule
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;The model drafts. A human signs. The signature happens with the actual API payload and a before→after diff on screen, not a chat bubble.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Everything else falls out of that rule.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Next.js 15 (App Router) + React 19 + Tailwind&lt;/strong&gt; for the dashboard. The dashboard is a Client Component with zero secrets in it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude via the Anthropic SDK&lt;/strong&gt; as the drafting engine, behind a small adapter (&lt;code&gt;lib/llm.ts&lt;/code&gt;) with a Gemini → Groq fallback so a provider outage never blocks triage. Every call has a 30 s timeout; a provider that returns an auth error is disabled for the rest of the process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route Handlers under `app/api/&lt;/strong&gt;&lt;code&gt;** and background workers are the only places that read &lt;/code&gt;.env.local`. Nothing secret ever reaches the browser bundle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;grammY Telegram bot&lt;/strong&gt; as the mobile approval surface: the same approve / regenerate / skip buttons a desktop user gets, delivered as cards.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vercel&lt;/strong&gt; for the dashboard, &lt;strong&gt;PM2 on a Linux VPS&lt;/strong&gt; for 24/7 workers when a team needs them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Inbound: one queue for Gmail, WhatsApp Business, Slack and Telegram
&lt;/h2&gt;

&lt;p&gt;Every channel normalises into the same &lt;code&gt;InboxItem&lt;/code&gt;: channel, sender, body, a &lt;code&gt;trace[]&lt;/code&gt; of timestamped reasoning steps, a classification (&lt;code&gt;urgent | normal | low&lt;/code&gt;) and a suggested next step.&lt;/p&gt;

&lt;p&gt;Two channel-specific lessons:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WhatsApp has no thread boundary.&lt;/strong&gt; A customer sends the invoice number, the complaint and "pls call" as three pings, sometimes from two numbers. Classifying individual messages gives you garbage. The fix was a windowing step: group by sender within ~10 minutes, then classify the &lt;em&gt;group&lt;/em&gt;. Also there is no quoting, so the reasoning trace has to carry the context the UI cannot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gmail has the opposite problem.&lt;/strong&gt; Long quoted chains where the actionable line is buried at the top of reply #7. Thread + subject + stable message ID make dedup easy, but the extraction prompt has to be told explicitly to ignore quoted history.&lt;/p&gt;

&lt;h2&gt;
  
  
  The approval gate: &lt;code&gt;ExecutionDiffModal&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;This is the component the whole product is built around. When a task is approved, it does &lt;strong&gt;not&lt;/strong&gt; execute. It opens a review with three panes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Payload&lt;/strong&gt; — the exact JSON that will be sent to Stripe / HubSpot / Xero. Derived from the task if the model did not supply one, so there is never an "unknown" payload.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Before → After&lt;/strong&gt; — a row-level diff of the state the write will change (deal stage, refund status, balance).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Draft&lt;/strong&gt; — the customer-facing text in an editable textarea. Edits flow into the payload.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The only button that runs anything is &lt;strong&gt;Confirm &amp;amp; Execute&lt;/strong&gt; (⌘/Ctrl+Enter), and it calls a deterministic executor, not the model. The model has no tool that writes to the outside world. That single architectural decision removes an entire class of prompt-injection outcomes: an injected instruction can at most change a &lt;em&gt;draft&lt;/em&gt;, which a human then reads.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Simplified: the model proposes, the executor disposes.&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;executeTask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;editedDraft&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;breakerActive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;hold&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"circuit breaker"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="nf"&gt;derivePayload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;editedDraft&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;connectors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// server-side, keys from .env&lt;/span&gt;
  &lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;actor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"human"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Low-risk items (acknowledgements, internal notes) can be bulk-approved with one key. Nothing is auto-sent unless the team flips that switch themselves in their own config.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keyboard triage, because approvals are a volume problem
&lt;/h2&gt;

&lt;p&gt;If a human has to approve everything, the approval UI must be faster than the thing it replaces. So: &lt;strong&gt;⌘K command palette&lt;/strong&gt;, &lt;strong&gt;J/K&lt;/strong&gt; to move, &lt;strong&gt;A&lt;/strong&gt; approve, &lt;strong&gt;R&lt;/strong&gt; reject, &lt;strong&gt;U&lt;/strong&gt; undo, and a &lt;strong&gt;10-second undo toast&lt;/strong&gt; on every destructive action. An operator can clear a 40-item morning queue in a couple of minutes without touching the mouse.&lt;/p&gt;

&lt;h2&gt;
  
  
  The circuit breaker
&lt;/h2&gt;

&lt;p&gt;Downstream APIs degrade. The naive agent keeps firing writes into a HubSpot that is answering in 3 seconds and timing out half the time, and you end up with half-applied state.&lt;/p&gt;

&lt;p&gt;The breaker is deliberately simple: a rolling latency sample per service; above a threshold (800 ms in the demo) the service is marked degraded, &lt;strong&gt;writes to it are held&lt;/strong&gt;, drafts keep queueing, and a banner shows recovery status. When latency drops back, held items resume from the queue and ask for a fresh approval, because the world may have changed while they waited.&lt;/p&gt;

&lt;p&gt;In the demo you can inject a crisis (HubSpot latency spike + a duplicate-charge complaint) with one click and watch the gate and the breaker interact.&lt;/p&gt;

&lt;h2&gt;
  
  
  Injection hardening
&lt;/h2&gt;

&lt;p&gt;Beyond "the model cannot write", three concrete measures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scrubbing.&lt;/strong&gt; Every model output is scrubbed for secret-shaped strings, the admin chat id and a restricted-term list before it is displayed anywhere, including Telegram.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimal context.&lt;/strong&gt; The triage model sees only the system prompt and the visitor's text. No tool list, no environment, no history it could be tricked into leaking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A self-test&lt;/strong&gt; (&lt;code&gt;scripts/selftest.ts&lt;/code&gt;) that runs five canned injection attempts and five bad drafts through the guardrail on every deploy and fails the build if any pass.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Keys and ownership
&lt;/h2&gt;

&lt;p&gt;Buyers of a build get the full source, a clean &lt;code&gt;.env.example&lt;/code&gt; listing every variable with an empty value, and a HANDOVER doc for Vercel and for Ubuntu + PM2. Their Anthropic key, their Stripe key, their HubSpot token: all in their own &lt;code&gt;.env.local&lt;/code&gt;, read only on the server. I never hold a client key. This matters more than any feature for the teams I work with, many of whom are in markets where "send us your API keys" is a non-starter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Async by design
&lt;/h2&gt;

&lt;p&gt;The same approval card renders in the dashboard and in Telegram. Someone in Lagos approves a refund from a phone at 09:30 WAT; the London accountant opens the log at 08:30 GMT and sees actor, time and target; nobody in Toronto had to be awake. Payment providers used across Africa (Paystack, Flutterwave) are first-class connectors next to Stripe, because that is what the teams asking for this actually run on.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would do differently
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Start with the execution diff on day one. I built triage first and the gate second; the gate is the product.&lt;/li&gt;
&lt;li&gt;Model the WhatsApp windowing explicitly in the data model instead of bolting it onto the classifier.&lt;/li&gt;
&lt;li&gt;Add the breaker before adding more connectors. Every connector is a new way for state to half-apply.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Live sandbox, no login: &lt;a href="https://caelaralabs.com" rel="noopener noreferrer"&gt;https://caelaralabs.com&lt;/a&gt; (click "Inject crisis", then approve something)&lt;/li&gt;
&lt;li&gt;Source (MIT): &lt;a href="https://github.com/kingefman1-cmyk/opsjarvis" rel="noopener noreferrer"&gt;https://github.com/kingefman1-cmyk/opsjarvis&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Telegram triage demo: &lt;a href="https://t.me/OpsJarvisAI_bot" rel="noopener noreferrer"&gt;https://t.me/OpsJarvisAI_bot&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy to go deep in the comments on the approval-gate design, the breaker thresholds or the injection tests.&lt;/p&gt;

&lt;p&gt;— OpsJarvis · Caelara Labs (&lt;a class="mentioned-user" href="https://dev.to/opsjarvisai"&gt;@opsjarvisai&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>ai</category>
      <category>nextjs</category>
      <category>opensource</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
