<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Lakpriya Senevirathna · Blog</title>
    <link>https://lakpriya.com/blog</link>
    <atom:link href="https://lakpriya.com/rss.xml" rel="self" type="application/rss+xml" />
    <description>Short, practical notes on mobile, payments and leading small teams.</description>
    <language>en</language>
    <lastBuildDate>Tue, 03 Nov 2026 00:00:00 GMT</lastBuildDate>
    <item>
      <title>BurnArc: know when Claude Code runs out, before it does</title>
      <link>https://lakpriya.com/blog/burnarc-claude-code-limits-mac-iphone-watch</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/burnarc-claude-code-limits-mac-iphone-watch</guid>
      <pubDate>Tue, 03 Nov 2026 00:00:00 GMT</pubDate>
      <description>Your Claude Code 5-hour and weekly limits live in the Mac menu bar, with run-out projections, pace markers and alerts. No account and no server.</description>
      <content:encoded><![CDATA[<p>[ccbar](/blog/ccbar-claude-code-usage-status-line) put my Claude Code limits under the prompt. That works while you&apos;re looking at the terminal. But I&apos;d often switch away, come back halfway through a refactor and find the 5-hour window already spent. I wanted the number somewhere I&apos;d see it without asking, so I built [BurnArc](https://lakpriya1s.github.io/burnarc/): a Mac menu bar app that shows your 5-hour and weekly limits live and tells you before you hit the wall.</p><p>What it shows</p><p>**Both windows at once.** Two nested arcs in the menu bar, the tightest limit outside and the other inside, with a number like `83%` or `83% · 1h32` next to them. **Run-out projection.** From your average burn since the window started, BurnArc works out when you&apos;ll reach 100%. It only shows it when that comes before the reset. **A pace marker.** A tick on every bar and arc shows where you&apos;d be if you spread usage evenly. Ahead of the tick means you&apos;re burning fast. **Alerts that matter.** A notification at 50, 75, 80 and 90%, when a window runs out and when it resets, once per window per cycle. **Every Claude account.** One per Claude Code profile, each with its own label, like `work` and `personal`. **Claude&apos;s status.** Incidents from Claude&apos;s status page show in the menu bar, so you can tell an outage from your own limit. **Trends and the live session.** A 7- and 30-day history of usage against even pace, plus the current session&apos;s model, effort, context window and approximate cost.</p><p>Click the menu bar icon for every account, window, pace and run-out time. Themes and switches let you show used or left, countdowns or clock times, and hide the parts you don&apos;t need.</p><p>How the run-out time works</p><p>The estimate is the same one ccbar uses: what&apos;s left × time elapsed ÷ what&apos;s used. Say you&apos;ve used 80% of a 5-hour window three hours in. That&apos;s an average of about 27% an hour, so the last 20% runs out in about 45 minutes, well before the window resets in two hours. BurnArc shows &quot;runs out in 45m&quot; and turns the arc orange.</p><p>How it gets the numbers</p><p>Claude Code already passes your usage to its status line on every refresh, so BurnArc doesn&apos;t need your login. When you add a profile folder, like `~/.claude` or `~/.claude-work`, BurnArc installs a small status-line hook there. The hook records the usage figures, then runs your existing status line with the same input, so ccbar or your own setup keeps working. You can switch to BurnArc&apos;s own status line instead, and uninstalling puts your original setting back.</p><p>Private by design</p><p>**No credentials.** BurnArc never sees your Claude password, OAuth token or API key, and never calls Anthropic&apos;s APIs for you. **No account and no server.** Nothing to sign up for. **Prompts never leave the Mac.** Only usage percentages, reset times, account labels and the live session&apos;s model, effort, cost and folder are shared, and only with your own devices. **Sandboxed and notarized.** The Mac app runs in Apple&apos;s sandbox, only touches the profile folders you choose, and has no analytics or tracking.</p><p>iPhone, Apple Watch and widgets</p><p>Apps for iPhone, Apple Watch and widgets are coming soon. You pair the iPhone by scanning a QR code on the Mac, and the numbers sync over your Wi-Fi with TLS, or through your own end-to-end encrypted iCloud when you&apos;re away. The watch gets them from the phone, so there&apos;s still no BurnArc server in between.</p><p>Try it</p><p>BurnArc for Mac is free. [Download the DMG](https://github.com/lakpriya1s/burnarc/releases/latest/download/BurnArc.dmg), drag it into Applications and add your Claude Code profiles. It needs macOS 15 or later, on Apple silicon or Intel, and a Claude Pro or Max plan, since those are the plans Claude Code reports limits for.</p><p>If you run several agents at once, [KinTerm](/blog/kinterm-terminal-for-ai-coding-agents) shows which one needs you from the tab bar.</p>]]></content:encoded>
      <category>Developer tools</category>
      <category>AI apps</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>KinTerm: a terminal where every tab shows what its AI agent is doing</title>
      <link>https://lakpriya.com/blog/kinterm-terminal-for-ai-coding-agents</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/kinterm-terminal-for-ai-coding-agents</guid>
      <pubDate>Tue, 03 Nov 2026 00:00:00 GMT</pubDate>
      <description>Run five Claude Code sessions and you lose track of which one needs you. KinTerm turns each tab into a face that is working, done, waiting on you or broken.</description>
      <content:encoded><![CDATA[<p>You run Claude Code in one tab, then another, then five. One is waiting for a yes, one finished ten minutes ago, one hit a rate limit, and the only way to find out is to click through every tab. I kept losing time that way, so I built [KinTerm](https://lakpriya.com/kinterm/): a macOS terminal where every tab is a face that shows what its agent is doing.</p><p>One glance at the tab bar tells you where to go next.</p><p>The five faces</p><p>**Idle:** gray, eyes shut, a drifting &quot;z&quot;. The session is ready for a prompt. **Working:** blue, eyes looking left and right while it reads, edits and runs tools. **Waiting on you:** amber, surprised and bouncing, with a &quot;?&quot;, when it asks for permission or a question. **Done:** green and happy when it finishes its turn, with a dot until you look. **Error:** red, X eyes and a little shake when the turn ends on an API error, like a rate limit.</p><p>A tab with splits shows its most urgent agent: waiting first, then error, done, working and idle.</p><p>When you&apos;re not looking at the terminal</p><p>The faces only help while the window is in front of you, so KinTerm also reports outside it:</p><p>**Notifications** when an agent finishes, needs you or fails. **The dock icon is a status light.** It takes the colour and expression of the agent that needs you most, with a badge for how many are waiting. **A menu bar summary** with a live count of your agents. **An agents panel.** `⌘⇧A` lists every agent in every window, most urgent first, and `⌘J` jumps straight to the next one waiting on you.</p><p>Hover a face and a card shows the agent&apos;s last message, how much of its context window is used, the git branch and the Claude account.</p><p>Several accounts, worktrees and subagents</p><p>If you use more than one Claude account, each gets its own colour as a tint or a ring on its tabs. The `+` menu and `⌥⌘1`–`⌥⌘9` open a Claude Code tab with a given account, optionally in a new git worktree, so parallel agents don&apos;t edit the same files. A small badge counts the subagents each session is running.</p><p>How it knows</p><p>The faces come from a small Claude Code hook that tells KinTerm what each session is doing. The Setup Assistant installs it on first launch, backing up your `settings.json` first.</p><p>`SessionStart` sets the face to idle. `UserPromptSubmit`, `PreToolUse` and `PostToolUse` set it to working. `Notification` sets it to waiting on you. `Stop` sets it to done, and `StopFailure` to error.</p><p>It isn&apos;t tied to Claude Code. KinTerm listens for OSC 7501, the Program Status Protocol, so any agent or script running in a tab can set its own face with one escape sequence:</p><p>printf &apos;\e]7501;state=working:app=my-agent\e\\&apos;   # blue, working
printf &apos;\e]7501;state=blocked:app=my-agent\e\\&apos;   # amber, waiting on you
printf &apos;\e]7501;state=done:app=my-agent\e\\&apos;      # green, done</p><p>Built on Ghostty</p><p>I didn&apos;t want to give up a fast terminal to get this, so KinTerm is a fork of [Ghostty](https://ghostty.org) with the agent faces on top. Emulation, GPU rendering, fonts, native tabs and splits are all Ghostty&apos;s, and KinTerm reads your existing Ghostty config and themes until you make one of its own.</p><p>Try it</p><p>Download **KinTerm.dmg** from the [latest release](https://github.com/lakpriya1s/kinterm/releases/latest), drag it to Applications and open it. It needs macOS 13 or later, on Apple silicon or Intel, and updates itself. The code is MIT licensed and on [GitHub](https://github.com/lakpriya1s/kinterm).</p><p>If you also want to see your Claude Code limits while the agents work, [ccbar](/blog/ccbar-claude-code-usage-status-line) puts them in the status line and [BurnArc](/blog/burnarc-claude-code-limits-mac-iphone-watch) puts them in the Mac menu bar.</p>]]></content:encoded>
      <category>Developer tools</category>
      <category>AI apps</category>
      <category>Open source</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>LookTap: I benchmarked 9 tools that let AI agents use a phone</title>
      <link>https://lakpriya.com/blog/looktap-benchmark-ai-agents-mobile-apps</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/looktap-benchmark-ai-agents-mobile-apps</guid>
      <pubDate>Sun, 18 Oct 2026 00:00:00 GMT</pubDate>
      <description>The same 12 steps on an iPhone simulator and an Android emulator, 10 runs each, checked by a neutral oracle. What an agent actually feels is calls, bytes and setup.</description>
      <content:encoded><![CDATA[<p>Coding agents can write a mobile screen in minutes, but most of them can&apos;t look at it. They build the app, say it works, and you find out on the phone that the button is hidden behind the keyboard. I built [LookTap](https://lakpriya.com/looktap/) so the agent can check for itself: it reads the screen as text, taps by label, types, swipes and reads the logs and crash reports, on iPhone and Android.</p><p>There are already several tools for this: Appium, Maestro, mobile-mcp, ios-simulator-mcp and others. So before telling anyone to use mine, I measured it against all of them.</p><p>What I measured</p><p>Every tool did the same 12 steps in the system Settings app: launch the app, read the screen, tap by label, go back, tap a point, swipe, scroll to a label, fill a field, take a screenshot, go home, open a URL and stop the app. Each tool ran the scenario 10 times on an iPhone 14 simulator (iOS 26) and a Pixel 9a emulator (Android 16), on one M3 Pro Mac.</p><p>Two choices made the numbers mean something:</p><p>**A neutral checker decided whether each step worked, not the tool.** On iOS that was `idb ui describe-all`; on Android, `dumpsys`. That mattered more than I expected: some tools reported success when nothing had happened. **Tools were driven the way an agent drives them.** MCP servers ran over stdio with `tools/call`, CLIs ran once per step, and when a tool couldn&apos;t act on a label, the step read the screen first and that read counted as a call.</p><p>Raw speed isn&apos;t what an agent feels most. Each tool call is another round trip through the model, which takes seconds, not milliseconds. So alongside the time until the result was on screen, I report **agent time**: that time plus 2 seconds for every call. I also count the bytes of text each tool returns, because every byte lands in the agent&apos;s context window.</p><p>The results</p><p>On iOS, over the 8 steps every tool can do:</p><p>| Tool | Agent time | Calls | Text returned | Setup | |---|---:|---:|---:|---:| | **LookTap CLI** | **21 s** | **8** | **747 B** | 0.5 s | | LookTap MCP | 25 s | 8 | 3.2 KB | 0.5 s | | Maestro MCP | 30 s | 9 | 17 KB | 18 s | | Appium MCP | 36 s | 10 | 102 KB | 29 s | | mobile-mcp | 39 s | 14 | 24 KB | 7.6 s | | ios-simulator-mcp | 44 s | 20 | 17 KB | 1.5 s |</p><p>On Android, over 11 steps, the LookTap CLI took 28 s against 49 s for Appium MCP, 60 s for Maestro MCP and 62 s for mobile-mcp. Reading the screen took 108 ms, against 1.6–5.6 s for the others.</p><p>The biggest gap is the text. For the whole iOS scenario the LookTap CLI sent the agent 747 bytes. The MCP servers sent 17–102 KB, and most of them put a 40–270 KB screenshot inline as well. LookTap saves the screenshot to a file and prints its path, so the agent only spends image tokens when it decides to look.</p><p>Where LookTap loses</p><p>A benchmark written by the author of one of the tools should say where that tool does worse, so here it is:</p><p>**On raw device time on iOS, ios-simulator-mcp is faster** (4.5 s against 5.2 s), mostly because its fill takes 0.5 s against LookTap&apos;s 1.8 s. It needs 20 calls where LookTap needs 8, though, and its swipes sometimes did nothing. **On Android, Maestro MCP needs one call fewer** (11 against 12), because it fills a field in a single call. **The LookTap MCP server is slower per action than the CLI.** Every action waits for the screen to settle and returns it, which saves a call but costs 0.7–1.9 s. On Android that makes the MCP&apos;s total 13 s against the CLI&apos;s 4.4 s. That&apos;s the clearest thing for me to fix. **LookTap 0.2.1, the version I measured, couldn&apos;t do two of the steps:** stopping an app, and the Home button on iOS. Both arrived in 0.3.0 (`looktap stop` and `looktap home`), but they aren&apos;t in these numbers.</p><p>And the limits of the benchmark itself: I wrote it and every adapter in it, LookTap was developed against this same app, and it covers one system app on a simulator and an emulator, not a real app on a real phone. The adapters are in the repo, and I&apos;d welcome corrections from the other tools&apos; authors.</p><p>Why the output is so small</p><p>Most agent mobile tools return the whole accessibility tree as JSON or XML. LookTap&apos;s `ls` prints one line per element that&apos;s actually on screen: a short ref, its type, its position and size, and its label.</p><p>@1   Button           16, 285 358x54  General
@2   Button           16, 339 358x54  Accessibility
@3   TextField        33, 773 324x38  Search  = Search</p><p>The agent taps by label (`looktap tap General`) or by ref, and adding `--ls` to any action returns the new screen in the same call. If a label matches more than one element, that&apos;s an error, never a guess. That&apos;s why one step is usually one call.</p><p>It&apos;s also why there&apos;s no server. Each platform gets a small helper that starts on first use and keeps running in the background: on iOS a macOS helper that reads the simulator&apos;s accessibility tree through Apple&apos;s simulator frameworks, and on Android a 10 KB jar pushed to the device that keeps one UiAutomation connection open. The CLI talks to it over a local socket, and the package has no npm dependencies.</p><p>Try it</p><p>npm install -g @looktap/cli
looktap doctor
looktap boot &quot;iPhone 16 Pro&quot;
looktap launch com.apple.Preferences --ls</p><p>In Claude Code, `looktap skill --install` teaches the agent how to use it, and there&apos;s an MCP server for chat apps that don&apos;t have a shell. The [full benchmark](https://github.com/lakpriya1s/looktap/blob/main/BENCHMARK.md), with every step, p90s, memory use and the commands to reproduce it, is in the [repo](https://github.com/lakpriya1s/looktap).</p>]]></content:encoded>
      <category>Developer tools</category>
      <category>AI apps</category>
      <category>Open source</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>A business payments app, from an empty repo to store builds in weeks</title>
      <link>https://lakpriya.com/blog/business-payments-app</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/business-payments-app</guid>
      <pubDate>Fri, 09 Oct 2026 00:00:00 GMT</pubDate>
      <description>I built a multi-currency business payments app in React Native, with hardware-backed biometric sessions and an approvals flow.</description>
      <content:encoded><![CDATA[<p>Finance teams needed to see balances across currencies, pay suppliers, convert currencies and approve each other’s payments from their phones. The web portal already did all of this, so the app had to bring the same features to mobile and be just as secure, starting from an empty repo.</p><p>In a payments app, security is part of every feature. Moving money needed a fresh check that the right person was holding the phone, and larger payments needed a second person to approve them.</p><p>At a glance</p><p>**Role:** Main mobile engineer **Timeline:** Aug – Oct 2026 **Stack:** React Native, Swift, Kotlin **Weeks** from the first commit to TestFlight and Play builds **3 native modules**, each in Swift and Kotlin **44 reusable components** in the app’s design system</p><p>Note: this is client work, so the client and product names are withheld.</p><p>A foundation that matches the web</p><p>I set up a React Native app in TypeScript, organised by feature: approvals, payments, wallets, payees and notifications.</p><p>**A typed API layer** built on the backend’s OpenAPI contract, with safe retries so a flaky connection can’t send a payment twice. **TanStack Query** for server data, **Zustand** for the session and **MMKV** for fast local storage. **Multi-currency amounts** handled exactly and formatted for each currency. **A mock API server** built from the same contract, so screens were built and tested while the backend was still in progress.</p><p>Security in native code</p><p>I wrote three native modules in Swift and Kotlin:</p><p>**Hardware-backed keys.** Approvals and the stored session are protected by keys held in the phone’s secure hardware (Secure Enclave on iPhone, Android Keystore and StrongBox on Android) and unlocked with Face ID or a fingerprint. **Biometric prompts** that work the same way on both platforms and notice when the enrolled biometrics change. **Screen protection** that keeps sensitive screens out of screenshots, screen recordings and screen sharing.</p><p>Much of this only behaves correctly on real devices, so I tested it on physical iPhones and Android phones across OS versions.</p><p>Payments with a second pair of eyes</p><p>**Sign-in** through the platform’s hosted login in a secure browser tab, so passwords never pass through the app. **Step-up checks.** Sensitive actions ask the user to confirm with biometrics or an authenticator code before they go through. **Approvals with separation of duties.** The person who raised a payment can’t approve it. Approvers can approve or reject with a reason, makers can withdraw their own payments, and expired requests are shown clearly. **Currency conversion** with live quotes and a countdown, so users always know whether a rate is still valid. **Payments and payees**, with the same approval rules as the web, purpose-of-payment codes, a quick Search &amp; Pay, and bank-detail validation for several payment rails. **Push notifications and links.** Firebase Cloud Messaging and Notifee for notifications, and universal links and App Links that open an approval straight from a notification or email, after the user unlocks the app.</p><p>A design system for the app</p><p>I built the app’s design system on the brand’s design tokens, checked against Figma and generated into styles, with CI catching any drift. On top of NativeWind and React Native Reusables it grew from 11 to 44 components, and an accessibility pass made colours and contrast meet WCAG AA.</p><p>Shipping it</p><p>Codemagic builds a QA APK, dev TestFlight and Play tracks, and production App Store and Play builds, with checks that stop a production build from pointing at the wrong environment. GitHub Actions run type checks, lint, tests and bundle builds on every pull request, and a Claude Code action reviews each PR for money, auth, data exposure and release risk.</p><p>The app went from an empty repo to store builds in weeks, with around 60 test suites. Alongside it I set up the team’s AI workspace: shared agent skills, semantic code search and device automation, so agents could check changes on a real simulator.</p>]]></content:encoded>
      <category>Case studies</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>Data explorers and profiles for a private-markets research platform</title>
      <link>https://lakpriya.com/blog/private-markets-data-platform</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/private-markets-data-platform</guid>
      <pubDate>Fri, 09 Oct 2026 00:00:00 GMT</pubDate>
      <description>For a subscription B2B platform, I scaffolded the Next.js app and built its data explorers, profile pages, entitlements and AWS delivery.</description>
      <content:encoded><![CDATA[<p>Analysts and investors needed to search and compare a very large set of companies, investors, funds and deals, filter them in ways a spreadsheet can’t, and export what they find. The business needed paid plans and free trials to control who sees which columns, and public profile pages that rank in search.</p><p>I made the first commit on the Next.js app and have worked on it since, alongside the client’s data and backend teams.</p><p>At a glance</p><p>**Role:** Senior engineer, first commit to today **Timeline:** Apr 2025 – Oct 2026 **Stack:** Next.js, TypeScript, AG Grid, AWS ECS **7 server-side data explorers** **2 apps:** the customer platform and the internal data app **106 columns** in the largest explorer</p><p>Note: this is client work, so the client and product names are withheld.</p><p>A Next.js app that renders on the server</p><p>**Next.js App Router** with React Server Components and TypeScript. **TanStack Query** for data on the client, with the first rows fetched on the server so explorer pages load instantly. **A typed REST API client** shared across the app, with filtering, sorting and CSV export for every list. **Caching per audience:** public pages are cached at the CDN, and signed-in pages stay fresh and private.</p><p>Explorers for very large datasets</p><p>I built the equity, debt and LP investor explorers, plus deals, companies, events and people, on AG Grid Enterprise.</p><p>**Server-side row model** with TanStack Query caching, so scrolling through very large tables stays fast. **Filters** that map straight to the API, including tree filters for industries and deal types. **Saved layouts** for column order, width and visibility, kept in Zustand. **CSV exports** generated on the server, as a paid feature.</p><p>Profiles, plans and permissions</p><p>**Profile pages** for companies, investors, funds and deals, with cap tables, funding and valuation charts, financials and fund performance on AG Charts. **Paid plans and free trials** tied to the billing platform, with hosted checkout and a billing portal. **Feature gating** that shows or locks each paid feature the same way on the server and in the browser. Visitors who aren’t signed in see a preview with an upgrade prompt. **Hosted sign-in** with smooth session refresh.</p><p>An internal tool for the data team</p><p>In 2026 I joined the rebuild of the client’s internal data-operations tool, where staff create and curate the records behind the platform.</p><p>**Next.js** with ky for API calls, zod to validate every response and react-hook-form for forms. **Explorers and review flows** for the data team, with tests that keep each column and filter in line with the agreed data model. **A reusable create form** driven by a schema, so each new record type is mostly configuration.</p><p>Delivery, monitoring and SEO</p><p>The app runs in Docker on AWS ECS Fargate behind CloudFront, built and deployed with CodePipeline and CodeBuild. GitHub Actions run type checks, lint, Jest tests and a build on every pull request. Sentry monitors errors and performance with session replay, and Segment handles analytics. Public profile pages use structured data, canonical URLs and incremental static regeneration so they rank in search.</p>]]></content:encoded>
      <category>Case studies</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>HushReply: free comment-to-DM for Instagram and Facebook</title>
      <link>https://lakpriya.com/blog/hushreply-free-comment-to-dm</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/hushreply-free-comment-to-dm</guid>
      <pubDate>Mon, 05 Oct 2026 00:00:00 GMT</pubDate>
      <description>The one ManyChat feature most creators use, as a self-hosted Cloudflare Worker with no contact limits and no monthly fee.</description>
      <content:encoded><![CDATA[<p>On Facebook and Instagram you post “Comment GUIDE and I’ll send it to you.” Someone comments GUIDE, and within a second they get a DM with the link, plus an optional “Check your DMs 📬” reply under their comment.</p><p>That is the one ManyChat feature most creators and businesses actually use. But ManyChat’s free plan now stops at 25 contacts, and one viral post can push you into a paid tier. HushReply does that one job, for free.</p><p>What it does</p><p>**Instagram and Facebook Pages** from one deployment. **Keyword rules** that ignore the word inside other words and handle emoji, so `LINK🙏` matches but `linked` doesn’t. **Public replies with rotating variations**, so it never looks copy-pasted. **Multiple accounts**, each with its own keywords. **A simple dashboard**: no code, and you can test a comment before it goes live. **Honest replies**: if the DM fails, the “check your DMs” reply is held back.</p><p>How it’s built</p><p>It runs as one small Worker in your own Cloudflare account, on the free plan, which covers about 500 keyword replies a day at $0. It uses Meta’s official private-replies API: no scraping, no browser automation and no password sharing. There is a one-click “Deploy to Cloudflare” button, and no Meta App Review is needed when you use it on your own accounts.</p><p>Under the hood</p><p>Each comment follows the same path through the Worker: webhook in, signature check, parse, find the account, find the rule, claim the comment, check the cooldown, send the DM, then post the public reply.</p><p>**Answer Meta first, work second.** Meta retries any webhook that responds slowly, so the Worker returns `200` immediately and does the Graph API calls in `ctx.waitUntil`. **Never DM twice.** Every comment id is claimed in Workers KV before anything is sent, so a redelivered webhook is ignored. A self-comment guard checks against every configured account, so two of your accounts can never get stuck replying to each other. **Signatures checked properly.** HMAC-SHA256 against each app secret, because Instagram Login uses a different secret from the Facebook app. **Emoji-aware matching.** JavaScript’s `\b` only understands ASCII, so the `word` match mode uses a hand-written Unicode word boundary. Other modes are contains, exact, starts-with, regex and any comment. **Stable replies.** The public reply variation is picked from the comment id, so a retried webhook posts the same text. **Tokens that don’t expire.** A daily cron refreshes Instagram’s long-lived tokens before their 60-day expiry. **Secrets stay out of `ps`.** The local dashboard only listens on 127.0.0.1 and passes tokens to `wrangler` through stdin or a `chmod 600` temp file, never as command-line arguments.</p><p>It ships with `DRY_RUN` on, and 82 unit tests run on Node’s built-in test runner.</p><p>To be honest about it: it is not a full ManyChat replacement. There is no flow builder and no broadcasts, and setup takes about an hour, mostly in Meta’s developer settings. But if all you need is “comment a keyword, get the DM”, you shouldn’t be paying monthly for it.</p><p>HushReply is open source under AGPL-3.0. Try it from the [website](https://lakpriya1s.github.io/hushreply/) or read the code on [GitHub](https://github.com/lakpriya1s/hushreply).</p>]]></content:encoded>
      <category>Open source</category>
      <category>Developer tools</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>Virtual cards straight into Apple Pay and Google Pay</title>
      <link>https://lakpriya.com/blog/card-issuing-and-digital-wallets</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/card-issuing-and-digital-wallets</guid>
      <pubDate>Thu, 01 Oct 2026 00:00:00 GMT</pubDate>
      <description>For an Australian embedded-finance platform, I integrated push provisioning into Apple Pay and Google Pay, Apple Wallet’s own “add card” extensions and a native secure card view, so users can pay with a new card seconds after receiving it.</description>
      <content:encoded><![CDATA[<p>The platform lets businesses issue branded prepaid Mastercards. Its consumer app lets people receive money as a gift and load it onto a virtual card. Users wanted that card in their phone wallet straight away, without typing a card number, and they needed to see the card details safely when shopping online.</p><p>My job was the integration work between the app, the card-tokenisation provider, Apple Pay, Google Pay and the platform’s own APIs.</p><p>At a glance</p><p>**Role:** Mobile engineer **Timeline:** Jul 2024 – Oct 2026 **Stack:** React Native, Swift, Kotlin, Apple Pay, Google Pay **2 wallets:** Apple Pay and Google Pay push provisioning, plus Apple Watch **2+ years** building and shipping the app with the client&apos;s team **1 tap** to add a new card to Apple Pay or Google Pay</p><p>Note: this is client work, so the client and product names are withheld.</p><p>Cards straight into Apple Pay and Google Pay</p><p>I integrated a certified card-tokenisation SDK for in-app push provisioning, so the app never handles the full card number.</p><p>**One tap to add.** On iOS, the app opens Apple’s Add to Apple Pay sheet. On Android, it uses Google Pay’s push provisioning flow. **Knowing where the card already is.** The app checks whether a card is already on the iPhone, on a paired Apple Watch or in Google Pay, and offers to add it to the devices that are missing it. **Handling every outcome.** Cancelled sheets, failed attempts and cards waiting for verification all return the user to a clear state.</p><p>Adding the card from inside Apple Wallet</p><p>I built Apple Wallet Issuer extensions, so a user can tap “+” in Wallet and add the card without opening the app.</p><p>A **non-UI extension** in Swift lists the cards that aren’t in Wallet yet, with their card art. A **UI extension** handles sign-in when Wallet needs the user to confirm who they are. Both can be switched off remotely, and the app and both extensions are signed and shipped together from CI.</p><p>Card details shown natively</p><p>To show the card number and security code for online shopping, I integrated the provider’s secure card view through a native Swift screen bridged into React Native, so sensitive card data stays inside native code.</p><p>Sign-in, config and app health</p><p>**Biometric sign-in** with Face ID, Touch ID and fingerprint, plus a guided prompt to move existing users onto it. **Remote config and feature flags**, so the team could turn features on and off and prompt users to update without a new release. **Monitoring with Datadog**: real-user monitoring, crash reporting and screen tracking. **Analytics with Segment**, sending events to the product and marketing tools. **Deep links with Branch.**</p><p>Shipping it</p><p>Codemagic builds dev and production apps for both stores, with dev builds pointing the tokenisation SDK at its sandbox so testers never touch live cards. iOS builds go to TestFlight automatically, and Android builds publish to Google Play. I also kept the app passing store review as Apple and Google requirements changed, including privacy manifests for third-party SDKs and support for newer Android devices.</p>]]></content:encoded>
      <category>Case studies</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>Family location sharing, installed on more than 200,000 Android phones</title>
      <link>https://lakpriya.com/blog/wheresnow-family-location</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/wheresnow-family-location</guid>
      <pubDate>Thu, 01 Oct 2026 00:00:00 GMT</pubDate>
      <description>Real-time location sharing for families and teams, with circles, geofenced places, SOS and 60-day history, grown to 200K+ installs.</description>
      <content:encoded><![CDATA[<p>Families kept sending “where are you?” texts. The apps that answered that question either drained the battery, felt like surveillance, or both. WheresNow set out to be the consent-first alternative: people join a circle by invite, choose to share, and see each other on one map without the phone running hot.</p><p>I’ve built WheresNow since its first commit in 2021, and rebuilt it twice as it grew.</p><p>At a glance</p><p>**Role:** Developer **Team:** Independent **Timeline:** 2021 – 2026 **Stack:** Android (Java), React Native, Google Maps SDK, Firebase, AWS **200K+ installs** on Google Play **60 days** of location history to replay **7 languages**, including Sinhala, Tamil and Japanese</p><p>Native Android on Firebase</p><p>The first version was a native Android app in Java, on Firebase Authentication and the Firebase Realtime Database. It used the Google Maps SDK, the Places SDK, the fused location provider and geofencing, with Google Play Billing for premium. It shipped in Sinhala and Tamil from the start, and this is the version that grew past 200,000 installs on Google Play.</p><p>React Native for iPhone and Android</p><p>To reach iPhone users, I rebuilt the app in React Native, with Codemagic builds set up from the start. React Native handles the screens and the live map, while location tracking lives in native modules written for each platform.</p><p>**App:** React Native, TypeScript, Hermes and Redux Toolkit. **Storage:** MMKV, encrypted with a key kept in the Keychain and Keystore. **Maps and location:** Google Maps, Core Location, the fused location provider and the Activity Recognition API.</p><p>Location tracking that respects the battery</p><p>**Android:** a foreground service in Kotlin on the fused location provider, with Activity Recognition to detect driving and a Room database that keeps updates offline until the server has them. **iOS:** Core Location in Swift, using significant-change and visit monitoring when the app is closed, and a notification service extension so a push can wake tracking up. **Fast only when someone is looking:** when a family member opens someone on the map, that phone switches to live updates for a few minutes, then drops back to a battery-friendly mode. **Places and alerts:** geofences on both platforms, with arrivals and departures queued and retried when the phone is offline.</p><p>Realtime backend and serverless API</p><p>**Realtime service:** Node.js, Socket.IO and MongoDB with Mongoose, in Docker on AWS EC2. It handles live location, journeys and the driving feed. **Serverless API:** TypeScript on AWS Lambda behind API Gateway and AWS WAF, deployed with the Serverless Framework and esbuild. **SOS alerts** that are saved in the database and retried until they’re delivered, so a server restart can’t lose one. **Subscriptions:** react-native-iap and StoreKit 2, checked on the server with the App Store Server API and Google Play developer notifications, including a Family plan.</p><p>Watches, web and admin</p><p>**Wear OS** app in Kotlin with Jetpack Compose for Wear OS, with its own tracking and SOS. **Apple Watch** app in SwiftUI, which shares location through the iPhone or on its own. **Admin dashboard** in React, Vite, Leaflet and Recharts for support, subscriptions and usage analytics. **Landing site** in Next.js, in seven languages.</p><p>How it ships now</p><p>GitHub Actions run each release from dev to staging to production across the mobile apps, the backend and over-the-air updates. Codemagic builds Android and Wear OS, Xcode Cloud builds iOS, and hot-updater ships JavaScript fixes over the air without a store review. Terraform manages the servers, and every pull request runs lint, type checks, tests and security scans with Checkov, hadolint and Gitleaks.</p><p>Today WheresNow covers live location, places, SOS, crash detection, scheduled check-ins, a driving feed, family chat with Google Drive and iCloud backup, and location history, in English, French, German, Spanish, Japanese, Sinhala and Tamil.</p><p>Links</p><p>[wheresnow.net](https://wheresnow.net/) [Google Play](https://play.google.com/store/apps/details?id=com.axresapps.wheresapplk) [App Store](https://apps.apple.com/app/id6749886062)</p>]]></content:encoded>
      <category>Case studies</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>Agent Rack: one MCP interface for all your AI coding agents</title>
      <link>https://lakpriya.com/blog/agent-rack-one-mcp-interface-for-ai-coding-agents</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/agent-rack-one-mcp-interface-for-ai-coding-agents</guid>
      <pubDate>Wed, 05 Aug 2026 00:00:00 GMT</pubDate>
      <description>Delegate tasks from Claude Code to Codex, opencode or Antigravity without copying context between tools.</description>
      <content:encoded><![CDATA[<p>When you are working in Claude Code, have you ever wanted to hand a task to Codex, get an alternative solution from Antigravity, or ask opencode to review your code? Usually that means opening several tools and copying context between them. That is why I built Agent Rack.</p><p>Agent Rack is an MCP server that wraps command-line coding agents. Claude Code, OpenAI Codex, opencode and Antigravity are built in, and any other CLI agent can be added with a small adapter. Point any MCP client at it, and your main agent can work with the others without leaving your workflow.</p><p>What you can do</p><p>Delegate quick tasks and get results straight back. Run long tasks as background sessions, and watch progress and live logs. Send follow-up instructions while an agent is running, or cancel it. Connect several profiles of the same agent as separate agents.</p><p>The real benefit is another agent’s context, not just another tool call. A sub-agent reads files, runs commands and reasons on its own budget, then hands back a result, so the work never fills your main conversation’s context window.</p><p>Structured code review</p><p>Agent Rack also does structured code reviews. Its adversarial review mode looks for hidden bugs, security issues, edge cases and release risks, and returns validated JSON instead of free text. The reviewing agent never changes your code; the final decision stays with you.</p><p>Built for Claude Code</p><p>In Claude Code it installs as a plugin, which adds the MCP server, tools and skills. You don’t need to remember tool names: describe what you want, and Claude Code delegates to the right agent, knowing when to run a quick task, when to start a background session and how to present review results. A terminal dashboard and a guided setup that detects installed agents come with it.</p><p>How it works under the hood</p><p>Agent Rack never calls a model or asks for an API key. It runs the agent CLIs already on your `$PATH`, with the logins you already have, and translates between them and MCP. It&apos;s written in TypeScript on the official MCP SDK, and its layers depend in one direction only: config, security, adapters, engine, tools, server, CLI.</p><p>Every agent speaks a different protocol, so each one gets its own adapter:</p><p>**Claude Code** streams newline-delimited JSON events, and follow-ups resume the same conversation with `claude --resume`. **Codex** runs through `codex exec` with JSON output and resumes by thread id. **OpenCode** only works interactively, so Agent Rack drives it through a real pseudo-terminal with `node-pty`. **Antigravity** has its own stream format.</p><p>Conversation ids are read from each CLI’s own output instead of being made up front, so a wrapper script configured in place of the real CLI keeps working.</p><p>Background sessions write to a ring buffer of 512 events with a byte budget. Clients read logs with a cursor that only moves forward, so they can tell when they missed something. Cancelling a session signals the whole process group, first with SIGINT and then SIGKILL (`taskkill /T` on Windows). A separate `cancelling` state keeps the concurrency limit honest while a process shuts down.</p><p>Security, stated plainly</p><p>Handing your terminal to another agent needs guard rails, and Agent Rack is explicit about which ones it has:</p><p>Workspaces are checked by their real path, and a single call can’t raise the execution policy above what the config allows (read-only, workspace-write or full access). Each agent gets an environment allow-list, and variables that look like secrets are stripped. Reviews always run read-only: Codex in its read-only sandbox, Claude Code in plan mode. The optional SSE endpoint, which the dashboard uses, needs a bearer token, accepts only loopback hosts and rejects requests with an `Origin` header, which blocks DNS-rebinding attacks from a browser.</p><p>It also says what it doesn’t do: a workspace allow-list isn’t a sandbox, only Codex enforces one at the OS level, and prompt injection isn’t solved.</p><p>Try it</p><p># guided setup: detects your agents and MCP clients
npx agent-rack setup</p><p># or, inside Claude Code
/plugin marketplace add lakpriya1s/agent-rack</p><p># watch every sub-agent live
agent-rack dashboard</p><p>It registers with Claude Code, Codex, Claude Desktop, Cursor, Antigravity and OpenCode, and prints a snippet for VS Code.</p><p>Agent Rack is open source on [GitHub](https://github.com/lakpriya1s/agent-rack) and on [npm](https://www.npmjs.com/package/agent-rack), where it has passed 8,000 downloads in its first year.</p>]]></content:encoded>
      <category>Developer tools</category>
      <category>AI apps</category>
      <category>Open source</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>ccbar: see your Claude Code limits without leaving the prompt</title>
      <link>https://lakpriya.com/blog/ccbar-claude-code-usage-status-line</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/ccbar-claude-code-usage-status-line</guid>
      <pubDate>Wed, 22 Jul 2026 00:00:00 GMT</pubDate>
      <description>A status line that shows context use and your 5-hour and 7-day limits as bars that turn from green to red.</description>
      <content:encoded><![CDATA[<p>Have you ever been deep in a Claude Code session and wondered how much usage you actually have left? Normally you stop, open the Claude website and check. Otherwise you keep spending context and limits without knowing how close you are to the edge. So I built ccbar.</p><p>What it shows</p><p>Model and effort level. Current workspace. Context-window usage. 5-hour and 7-day limits, with the time left until each resets.</p><p>The bars change from green to yellow to red, so you can read your remaining headroom at a glance. When your current pace would use up a limit before it resets, ccbar adds a warning with the estimated time. Styles and themes let it match your terminal.</p><p>Install</p><p>npx ccbar-cli</p><p>How it works</p><p>Claude Code can run any command as a status line and pipe it a JSON object on every refresh. That JSON already includes the model, effort level, working directory, context-window percentage, cost, and both rate limits with their `used_percentage` and `resets_at` time. ccbar is a single Bash script that reads those fields with `jq` and draws two lines of coloured bars.</p><p>{
  &quot;statusLine&quot;: {
    &quot;type&quot;: &quot;command&quot;,
    &quot;command&quot;: &quot;~/.local/bin/ccbar render&quot;,
    &quot;padding&quot;: 0
  }
}</p><p>**No network calls and no tokens.** Everything comes from the data Claude Code already passes in, so it’s instant and works offline. **Burn-rate warning.** From how much of a window you’ve used and how long is left until it resets, ccbar estimates whether your current pace runs out first, and when. **Local history.** It caches the last payload for `ccbar stats` and appends a small, throttled history file (at most once a minute, size-capped), so `ccbar history` can draw a 7-day sparkline with estimated cost. **One dependency.** Bash and `jq`. A small Node wrapper exists only so `npx` can install it.</p><p>The installer wires ccbar into your Claude Code settings, backing up the file first, and runs a short setup wizard. It is also available as a Claude Code plugin. The code is on [GitHub](https://github.com/lakpriya1s/ccbar).</p>]]></content:encoded>
      <category>Developer tools</category>
      <category>Open source</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>Running a fraud-detection LLM entirely on the phone</title>
      <link>https://lakpriya.com/blog/fraud-detection-llm-on-device</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/fraud-detection-llm-on-device</guid>
      <pubDate>Mon, 14 Jul 2025 00:00:00 GMT</pubDate>
      <description>How fine-tuned, quantised LLMs under 1B parameters reached 99.5% accuracy on mobile, offline. My RANLP 2025 paper in plain English.</description>
      <content:encoded><![CDATA[<p>My MSc research project was accepted for presentation at RANLP 2025: *Efficient Financial Fraud Detection on Mobile Devices Using Lightweight Large Language Models*. It tackles a simple question. Can a phone run an LLM good enough to catch scam messages, without sending anything to the cloud?</p><p>The problem</p><p>Digital transactions grow every day, and so do fraudulent SMS and emails. Traditional detection models are often cloud-dependent, which brings problems with efficiency, scale and especially privacy. Large language models understand language well, but they are usually too heavy for a phone.</p><p>The approach</p><p>Fine-tune compact LLMs, under 1B parameters, for one task: spotting fraud in unstructured text. Use LoRA and QLoRA so fine-tuning fits modest hardware. Convert to ONNX with Hugging Face Optimum, then quantise to INT8 and 4-bit. Run the models with ONNX Runtime inside a React Native app, fully offline.</p><p>Making it run on a phone</p><p>Getting a trained model onto a phone took more work than training it.</p><p>**Download only what’s needed.** The app reads a model list from GitHub and lets you pick a model and a quantisation level. It then fetches just the config, the tokenizer and that one `.onnx` file from Hugging Face, with resumable downloads and per-file progress. **Tokenising on Hermes.** The JavaScript tokenizer expected a browser, so I patched it to load only local files, rewrote Unicode regexes that Hermes doesn’t support, and added `TextEncoder` and `Buffer` polyfills. **Answer in a few tokens.** The model only needs to say “Yes” or “No”, so generation stops after five tokens, using greedy decoding with a KV cache in ONNX Runtime. The app shows how long each check took.</p><p>The results</p><p>The fine-tuned, quantised Llama-160M-Chat-v1 reached **99.47%** accuracy with a **168 MB** footprint. The fine-tuned, quantised Qwen1.5-0.5B-Chat reached **99.50%** at 797 MB. Optimised LLMs can deliver accurate, real-time fraud detection on a phone without compromising privacy.</p><p>Let’s make AI safer and smarter, right in our pockets.</p><p>The app, FraudShield, is live on the [App Store](https://apps.apple.com/app/id6745196395) and [Google Play](https://play.google.com/store/apps/details?id=lakpriya.fraudShield), and the paper is in the [ACL Anthology](https://aclanthology.org/2025.ranlp-1.126/). Thanks to my supervisor, Deshan Sumanathilaka, for his guidance from the first idea to deployment.</p>]]></content:encoded>
      <category>Research</category>
      <category>AI apps</category>
      <category>React Native</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>Four consumer AI apps, each live on iOS and Android</title>
      <link>https://lakpriya.com/blog/ai-consumer-apps</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/ai-consumer-apps</guid>
      <pubDate>Mon, 07 Jul 2025 00:00:00 GMT</pubDate>
      <description>Sparkle AI, MemeFrog, Tasklio AI and VisChef: chat, image, voice and vision features built with React Native and shipped to both stores.</description>
      <content:encoded><![CDATA[<p>Every AI feature looks easy in a demo. The hard part is making it fast, affordable and pleasant on a phone, keeping API keys off the device, and getting it through App Store and Google Play review.</p><p>Each of these apps uses a different AI pattern, and I picked the backend to suit it.</p><p>At a glance</p><p>**Role:** Developer and publisher **Team:** Independent **Timeline:** Jun 2023 – Jul 2025 **Stack:** React Native, OpenAI and other LLM APIs **4 AI apps** live on the App Store and Google Play **2 platforms** for every app, iOS and Android **4 AI modes:** chat, generation, voice and vision</p><p>Sparkle AI: streaming chat (2023)</p><p>A ChatGPT-style assistant in React Native, built in the months after the ChatGPT API launched.</p><p>**OpenAI Chat Completions API** with streaming over server-sent events (react-native-sse), so answers appear as they’re written. **GPT-3.5 Turbo or GPT-4**, with custom instructions the user can edit. **Redux Toolkit** with AsyncStorage for saved chats. **Native touches:** voice input with the phone’s speech recognition, code blocks with syntax highlighting, and haptics while answers stream.</p><p>I later turned the chat screen into an open-source library, [react-native-sparkle-ai-chat](/blog/add-ai-chat-to-a-react-native-app), so other apps can drop it in.</p><p>MemeFrog: two models, one tap (2025)</p><p>An Expo and React Native app that turns a topic into a finished meme.</p><p>**A text model writes the joke** as structured JSON: captions and a prompt for the picture. **An image model draws it** in one of many visual styles, and the app adds the captions on top. **Moderation** on what the user types and on what the models return, plus a way to report a meme. **Sharing** with react-native-view-shot, and EAS Update for over-the-air fixes.</p><p>Tasklio AI: tasks by voice (2025)</p><p>Tasklio AI lets people say a task out loud instead of typing it, then turns it into a structured task and helps prioritise the list.</p><p>VisChef: from a fridge photo to dinner (2025)</p><p>I built VisChef in about a week for the Bolt.new hackathon.</p><p>**Expo** with Expo Router and Expo Camera. **Supabase:** Auth, Postgres with row-level security, and Edge Functions that call the OpenAI API, so no key ships in the app. **GPT-4o mini vision** spots the ingredients in a photo, then suggests recipes as structured JSON, shaped by the user’s diet and favourite cuisines. **Pexels API** for recipe photos.</p><p>VisChef grew out of Recipio, an earlier SwiftUI prototype of the same idea.</p><p>What carried across all four</p><p>Use structured JSON whenever the app has to act on what the model says, and always have a fallback. Keep keys on a server unless the user brings their own. Moderate what the model writes as well as what the user types. Stream anything longer than a sentence. All four apps are on the [apps page](/apps), with store links.</p><p>Links</p><p>[See all apps](/apps)</p>]]></content:encoded>
      <category>Case studies</category>
      <category>AI apps</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>Add an AI chat assistant to your React Native app</title>
      <link>https://lakpriya.com/blog/add-ai-chat-to-a-react-native-app</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/add-ai-chat-to-a-react-native-app</guid>
      <pubDate>Thu, 22 Feb 2024 00:00:00 GMT</pubDate>
      <description>Sparkle AI Chat is an open-source, brandable chat screen for React Native that skips most of the OpenAI documentation.</description>
      <content:encoded><![CDATA[<p>Almost every platform is trying to add a ChatGPT-like assistant. To do it, developers have to work through the OpenAI documentation, which takes time. So I packaged the work into my first npm package: a React Native library that brings an AI assistant to your app.</p><p>Install</p><p>npm i react-native-sparkle-ai-chat @react-native-async-storage/async-storage</p><p>Use it</p><p>Give it a platform, an API key and instructions for the assistant, and brand it with your own name, logo and colours.</p><p>import SparkleChat from &apos;react-native-sparkle-ai-chat&apos;;</p><p>&lt;SparkleChat
  platform=&quot;openai&quot;
  apiKey={OPENAI_API_KEY}
  instruction=&quot;You help customers choose from the coffees on our menu.&quot;
  brand={{ name: &apos;Coffee Assistant&apos;, primaryColor: &apos;#FF5C5C&apos; }}
/&gt;</p><p>What’s inside</p><p>The library is the chat screen from my [Sparkle AI app](/blog/sparkle-ai-chatgpt-mobile-app), extracted into a package built with `react-native-builder-bob`, so it ships CommonJS, ES modules and TypeScript types.</p><p>**Streaming** over server-sent events with `react-native-sse`, so answers appear as they’re written. **History** kept in Redux Toolkit and persisted to AsyncStorage, which is why AsyncStorage is a peer dependency. **Token budget.** Older messages are trimmed so the conversation fits the model’s context window. **Your own backend.** `apiBaseUrl` and `organization` let you point it at a proxy or any OpenAI-compatible endpoint instead of shipping a key in the app, and `completionParams` passes model, temperature and other options straight through.</p><p>Tip: for a production app, put your key behind a small proxy and set `apiBaseUrl`. A key bundled in an app can be extracted.</p><p>Next: function calling, so users can trigger the app’s own features by asking the assistant, and support for more AI platforms such as Gemini.</p><p>It is open source, and contributions are welcome on [GitHub](https://github.com/lakpriya1s/react-native-sparkle-ai-chat).</p>]]></content:encoded>
      <category>React Native</category>
      <category>AI apps</category>
      <category>Open source</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
    <item>
      <title>Sparkle AI: a ChatGPT-style assistant for iOS and Android</title>
      <link>https://lakpriya.com/blog/sparkle-ai-chatgpt-mobile-app</link>
      <guid isPermaLink="true">https://lakpriya.com/blog/sparkle-ai-chatgpt-mobile-app</guid>
      <pubDate>Mon, 19 Jun 2023 00:00:00 GMT</pubDate>
      <description>An AI chat app built with React Native on the OpenAI API, with model choice, custom instructions and saved chats.</description>
      <content:encoded><![CDATA[<p>I built a ChatGPT-style mobile app with React Native and the OpenAI API. It acts as a personal assistant that helps you stay organised and productive, and it is live on the App Store and Google Play as Sparkle AI.</p><p>What it does</p><p>Choose the model for each conversation, GPT-3.5 Turbo or GPT-4. Set custom system messages to shape how the assistant answers. Save chats and come back to them later.</p><p>How it’s built</p><p>Sparkle AI is a bare React Native app (0.71 at launch) with TypeScript, and it calls the OpenAI Chat Completions API directly: you bring your own API key, so there’s no server in between.</p><p>**Streaming, word by word.** React Native has no built-in server-sent events, so the client streams completions with `react-native-sse`. Each delta is appended to the message in Redux as it arrives, a stop button closes the stream, and errors appear in the chat instead of failing silently. **Conversations that persist.** Chats are stored in Redux Toolkit with redux-persist on AsyncStorage. Each request rebuilds the conversation from the current chat, with your instructions as the system message, and trims it to the model’s token budget. **Feels like a native app.** Code blocks get syntax highlighting and a copy button, a long press copies any message, voice input uses the phone’s own speech recognition, and a light haptic tap scales with the size of each streamed chunk. **Smooth long chats.** An inverted list is the usual way to build a chat, but on Android it flips with `scaleY: -1`, which is a known source of jank. I patched it to rotate 180° instead.</p><p>If you want the same kind of assistant inside your own app, my open-source [React Native chat library](/blog/add-ai-chat-to-a-react-native-app) packages it as a single component.</p><p>Download Sparkle AI from the [App Store](https://apps.apple.com/app/id6450364523) or [Google Play](https://play.google.com/store/apps/details?id=lk.codescale.sparkle).</p>]]></content:encoded>
      <category>AI apps</category>
      <category>React Native</category>
      <dc:creator>Lakpriya Senevirathna</dc:creator>
    </item>
  </channel>
</rss>
