<?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: Souf CH</title>
    <description>The latest articles on DEV Community by Souf CH (@chafian).</description>
    <link>https://dev.to/chafian</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%2F4219965%2F5944603e-af86-4e9d-9370-a9e701b27098.jpg</url>
      <title>DEV Community: Souf CH</title>
      <link>https://dev.to/chafian</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chafian"/>
    <language>en</language>
    <item>
      <title>I built a Windows terminal for running AI coding agents in parallel. Here's what I learned.</title>
      <dc:creator>Souf CH</dc:creator>
      <pubDate>Mon, 16 Nov 2026 01:45:08 +0000</pubDate>
      <link>https://dev.to/chafian/i-built-a-windows-terminal-for-running-ai-coding-agents-in-parallel-heres-what-i-learned-169b</link>
      <guid>https://dev.to/chafian/i-built-a-windows-terminal-for-running-ai-coding-agents-in-parallel-heres-what-i-learned-169b</guid>
      <description>&lt;p&gt;A few weeks ago my typical workday looked like this: four or five terminal tabs, each with an AI coding agent running in a different project. Claude Code refactoring a backend, Codex writing tests somewhere else, Gemini CLI poking at a script.&lt;/p&gt;

&lt;p&gt;And I kept losing track of them.&lt;/p&gt;

&lt;p&gt;An agent would stop to ask for permission, and I'd notice twenty minutes later. Another one would finish while I was looking at the wrong tab. I'd restart my PC and lose which conversation was running where. On Windows, with PowerShell in some tabs and WSL in others, it got messy fast.&lt;/p&gt;

&lt;p&gt;So I built SplitNest: a free, open-source (MIT) Windows terminal workspace built around AI coding agents. This post covers what it does, the parts that were surprisingly hard, and how I built most of it with Claude Code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fol8ao06sqi6xijh4qxwz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fol8ao06sqi6xijh4qxwz.gif" alt="SplitNest demo: agent tabs, notification and inbox" width="600" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What it does&lt;/p&gt;

&lt;p&gt;Projects, not windows. Each project folder is a workspace in the sidebar, with its own layout of split panes. You run real PowerShell and WSL shells side by side, switch projects, and the background sessions keep running.&lt;/p&gt;

&lt;p&gt;Tabs that know an agent is running. When Claude Code, Codex, Gemini CLI, Copilot CLI, Aider or a few others run in a tab, the tab shows the agent's logo and its live state: Working, Needs you, Done or Error. The sidebar sums it up per workspace ("1 agent needs you · 2 working").&lt;/p&gt;

&lt;p&gt;You never miss a prompt. When an agent needs a permission, asks a question, finishes or fails, SplitNest tells you in the way that fits: nothing if you're looking at that tab, an in-app notice if another tab is in front, a Windows notification and a taskbar flash if the app is in the background.&lt;/p&gt;

&lt;p&gt;One inbox for every agent. Ctrl+Shift+A lists every agent waiting on you across all workspaces, most urgent first. Ctrl+Shift+U jumps to the next one.&lt;/p&gt;

&lt;p&gt;Parallel agents without collisions. New agent task creates a Git worktree and a new branch, opens it as its own workspace and starts the agent there. Several agents can work on the same repository without ever touching the same files. A Changes panel shows the diff live while the agent works, and Finish merges it back (conflicts are checked first).&lt;/p&gt;

&lt;p&gt;Resume after a restart. If Claude Code, Codex or Gemini CLI was running when SplitNest closed, that terminal offers a Resume button for that exact conversation.&lt;/p&gt;

&lt;p&gt;It's private by design: no telemetry, and terminal output, command history and credentials are never saved.&lt;/p&gt;

&lt;p&gt;How does it know what an agent is doing?&lt;/p&gt;

&lt;p&gt;This was the most interesting design question. SplitNest uses three sources, in order of trust:&lt;/p&gt;

&lt;p&gt;The agent reports its own state. Some agents speak a small escape-sequence protocol (OSC 7501, the Program Status Protocol). Claude Code waits for the terminal to answer a feature query before it starts reporting, so SplitNest answers it. Codex reports on its own.&lt;br&gt;
Process detection. A small helper detects agent processes started in a terminal, in PowerShell and in WSL (where it reads only /proc, and nothing is installed in the distribution).&lt;br&gt;
Fallbacks. Bell characters and spinner patterns for agents that report nothing.&lt;/p&gt;

&lt;p&gt;The important part: a reported state is shown solid, a guess is shown dashed with a "?". I didn't want a tool that pretends to know more than it does. And SplitNest never changes an agent's settings or hooks to get this information.&lt;/p&gt;

&lt;p&gt;The hard part: terminals on Windows&lt;/p&gt;

&lt;p&gt;I expected the agent features to be the hard part. They weren't. The hard part was making a terminal behave correctly on Windows.&lt;/p&gt;

&lt;p&gt;SplitNest is an Electron app using xterm.js for rendering and node-pty for the shells. On Windows, node-pty talks to ConPTY, the Windows pseudo-console. A few things I learned the hard way:&lt;/p&gt;

&lt;p&gt;Resizing is where everything breaks. ConPTY redraws the whole screen after a resize, and it expects the terminal to re-wrap lines exactly the way the old Windows console did. xterm.js re-wraps differently. With the ConPTY DLL bundled in node-pty, I measured 35 out of 64 screen checks coming out different after resizes. Switching to the system ConPTY fixed the repaints, but introduced its own issue: the boundary between scrollback and screen moved on every resize. The fix ended up being a careful resize protocol: one resize in flight at a time, the PTY confirms the new size before xterm resizes, and the console's redraw is held until it's safe to apply.&lt;/p&gt;

&lt;p&gt;Never fit a terminal inside requestAnimationFrame. With the WebGL renderer, the canvas gets cleared one frame before it's redrawn, which shows up as a flash. Scheduling the fit on a normal timer task fixed it.&lt;/p&gt;

&lt;p&gt;Keep terminals outside React. Each pane's xterm instance lives in a plain controller object that owns its DOM element. React only attaches and detaches that element. Splitting panes, switching workspaces or StrictMode double-rendering never recreate a terminal or kill a shell process, and output never goes through React state.&lt;/p&gt;

&lt;p&gt;Packaging native modules is its own project. node-pty ships native files, conpty.dll and a worker script that's loaded by path, so they have to be unpacked from Electron's ASAR archive. And in the packaged app, node-pty's kill() tried to fork a helper process, which would have started a second copy of SplitNest. A small "fork guard" that answers that request in-process fixed it.&lt;/p&gt;

&lt;p&gt;Run the PTY in a separate process. All shells live in an Electron utility process, not in the main process. If something goes wrong with a shell, the UI stays responsive, and the boundaries between the sandboxed UI, the main process and the shells stay clear.&lt;/p&gt;

&lt;p&gt;How I built it with Claude Code&lt;/p&gt;

&lt;p&gt;Most of SplitNest's code was written together with Claude Code. Fitting, since the app exists to run agents like it. A few things made the difference:&lt;/p&gt;

&lt;p&gt;A written plan with milestones, and evidence for each one. I didn't ask for "a terminal app with split panes". The plan had milestones: a real PowerShell PTY in development and in the packaged build, validated IPC and session ownership, workspaces and splits, WSL, persistence, UI, packaging. Each milestone was only "done" when there was evidence: a test, an end-to-end run, a measurement.&lt;/p&gt;

&lt;p&gt;Tests against real shells, not mocks. For a terminal, mocks lie. The test suite starts real PowerShell sessions through ConPTY and real WSL sessions, and Playwright drives the packaged app end to end. Many things that "looked done" in a quick check failed there, and that's exactly what I wanted to know.&lt;/p&gt;

&lt;p&gt;Make it prove things in the real environment. The resize work above is a good example. Instead of "fix the resize bug", the task was to measure: run screen checks before and after, compare against what the console expects, and only then change the approach.&lt;/p&gt;

&lt;p&gt;Automate the release pipeline early. Releases are built only by GitHub Actions from a version tag, with SHA-256 sums and build provenance attestations. That matters for a tool people install on their machines, especially while the installer isn't code signed yet.&lt;/p&gt;

&lt;p&gt;My biggest takeaway: AI agents are very good at producing code that looks finished. Small, verifiable steps and tests in the real environment are what turn that into software that actually works.&lt;/p&gt;

&lt;p&gt;Try it&lt;/p&gt;

&lt;p&gt;SplitNest runs on Windows 11 x64. It's an early release (v0.3), free and MIT licensed.&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/chafian/splitnest" rel="noopener noreferrer"&gt;github.com/chafian/splitnest&lt;/a&gt;&lt;br&gt;
Website: &lt;a href="https://splitnest.dev" rel="noopener noreferrer"&gt;splitnest.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One honest caveat: the installer isn't code signed yet (an application to the SignPath Foundation is pending), so Windows SmartScreen will warn you the first time. The README explains how to verify the download with its SHA-256 hash and the GitHub attestation. There's also a portable ZIP.&lt;/p&gt;

&lt;p&gt;If you run several coding agents on Windows, I'd love your feedback: what's missing, what breaks, how you work. And if you find it useful, a ⭐ on GitHub helps other developers find it.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>productivity</category>
      <category>claude</category>
    </item>
    <item>
      <title>Exploring tenant isolation with Spring Boot, OIDC, and PostgreSQL RLS</title>
      <dc:creator>Souf CH</dc:creator>
      <pubDate>Sun, 01 Nov 2026 04:25:38 +0000</pubDate>
      <link>https://dev.to/chafian/exploring-tenant-isolation-with-spring-boot-oidc-and-postgresql-rls-3e22</link>
      <guid>https://dev.to/chafian/exploring-tenant-isolation-with-spring-boot-oidc-and-postgresql-rls-3e22</guid>
      <description>&lt;p&gt;A multi-tenant API needs to answer two separate questions: who is making the request, and what may that identity do inside the selected tenant?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/chafian/spring-boot-saas-starter" rel="noopener noreferrer"&gt;Spring Boot SaaS Starter&lt;/a&gt; is an open-source backend MVP I maintain to make those boundaries easier to inspect. It provides a Projects API with tenant membership, role checks, optimistic concurrency, and audit records.&lt;/p&gt;

&lt;p&gt;The current stack uses Java 25, Spring Boot 4.1.2, PostgreSQL, JDBC, and Flyway. Docker Compose includes Keycloak for local development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication establishes identity
&lt;/h2&gt;

&lt;p&gt;The API accepts bearer tokens through Spring Security’s JWT resource server support. Its configuration validates the signature and issuer, requires an audience match, and checks for a nonblank subject and an expiration claim.&lt;/p&gt;

&lt;p&gt;The subject identifies the caller. Memberships associate that subject with a tenant and a role in the application database.&lt;/p&gt;

&lt;p&gt;This distinction matters: a valid token alone does not establish membership in a particular tenant. The tenant UUID in a request selects the tenant to access; authorization still happens in the service layer.&lt;/p&gt;

&lt;p&gt;See the implementation in &lt;a href="https://github.com/chafian/spring-boot-saas-starter/blob/main/src/main/java/io/github/chafian/saas/security/SecurityConfig.java" rel="noopener noreferrer"&gt;SecurityConfig.java&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Follow the tenant boundary into the database
&lt;/h2&gt;

&lt;p&gt;The starter uses a shared schema with complementary application and database checks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A transactional service checks and locks the caller’s membership row.&lt;/li&gt;
&lt;li&gt;It verifies the role required for the operation.&lt;/li&gt;
&lt;li&gt;It sets transaction-local database context for the tenant.&lt;/li&gt;
&lt;li&gt;Queries include explicit tenant predicates.&lt;/li&gt;
&lt;li&gt;PostgreSQL enforces row-level security on projects and audit events.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://github.com/chafian/spring-boot-saas-starter/blob/main/src/main/java/io/github/chafian/saas/tenancy/TenantAccess.java" rel="noopener noreferrer"&gt;TenantAccess.java&lt;/a&gt; activates the context using a parameterized query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="nf"&gt;set_config&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'app.tenant_id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The final argument makes the setting local to the transaction. The design therefore avoids leaving tenant state attached to a pooled connection after the transaction finishes.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/chafian/spring-boot-saas-starter/blob/main/src/main/resources/db/migration/V1__tenant_foundation.sql" rel="noopener noreferrer"&gt;database migration&lt;/a&gt; enables and forces row-level security on both protected tables. Policies compare each row’s &lt;code&gt;tenant_id&lt;/code&gt; with the current transaction’s tenant setting, including checks on writes.&lt;/p&gt;

&lt;p&gt;Tenant and membership tables have a different role: they support onboarding and membership discovery across tenants. Their authorization boundary is enforced in services.&lt;/p&gt;

&lt;p&gt;The application also uses restricted runtime database credentials, separate from schema migration credentials. Startup checks reject unsafe database privileges or missing RLS enforcement.&lt;/p&gt;

&lt;p&gt;These layers help defend against accidentally omitted tenant predicates. They do not make a compromised application or arbitrary SQL execution harmless. The &lt;a href="https://github.com/chafian/spring-boot-saas-starter/blob/main/docs/architecture.md" rel="noopener noreferrer"&gt;architecture guide&lt;/a&gt; explains that boundary explicitly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep permissions specific to each tenant
&lt;/h2&gt;

&lt;p&gt;The role model is deliberately small:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Capability&lt;/th&gt;
&lt;th&gt;OWNER&lt;/th&gt;
&lt;th&gt;ADMIN&lt;/th&gt;
&lt;th&gt;MEMBER&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Read projects and list members&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Create, update, or delete projects&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read audit events&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Manage non-owner memberships&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;An authenticated identity can create a tenant and becomes its owner. Ownership transfer and owner removal are outside this MVP.&lt;/p&gt;

&lt;p&gt;A caller who is not a tenant member receives &lt;code&gt;404&lt;/code&gt; for tenant resources. A member who lacks the required role receives &lt;code&gt;403&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make conflicting writes explicit
&lt;/h2&gt;

&lt;p&gt;Projects carry a version number. Updates match the tenant, project ID, and expected version, then increment the version. Deletions also require the expected version.&lt;/p&gt;

&lt;p&gt;For example, after updating version &lt;code&gt;0&lt;/code&gt; successfully, a deletion that still supplies version &lt;code&gt;0&lt;/code&gt; receives &lt;code&gt;409 Conflict&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The client should reload the project and reconcile changes before retrying. Automatically substituting the latest version would defeat the purpose of detecting a stale write.&lt;/p&gt;

&lt;p&gt;Project mutations and their audit records occur within the same transaction. See &lt;a href="https://github.com/chafian/spring-boot-saas-starter/blob/main/src/main/java/io/github/chafian/saas/project/ProjectService.java" rel="noopener noreferrer"&gt;ProjectService.java&lt;/a&gt; and the &lt;a href="https://github.com/chafian/spring-boot-saas-starter/blob/main/docs/api.md#local-curl-walkthrough" rel="noopener noreferrer"&gt;API walkthrough&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run the local example
&lt;/h2&gt;

&lt;p&gt;The README’s container-based path requires Git, a POSIX shell, Docker Engine with Compose v2, OpenSSL, and Python 3.9+. On Windows, use WSL with Docker access. Ports &lt;code&gt;8080&lt;/code&gt;, &lt;code&gt;8081&lt;/code&gt;, and &lt;code&gt;5432&lt;/code&gt; must be available.&lt;/p&gt;

&lt;p&gt;A host JDK is unnecessary for this path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/chafian/spring-boot-saas-starter.git
&lt;span class="nb"&gt;cd&lt;/span&gt; spring-boot-saas-starter
./scripts/init-env.sh
docker compose up --build -d
python3 scripts/smoke.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The setup script generates local credentials. The smoke script waits for readiness, signs in as the demo identities, and exercises the API.&lt;/p&gt;

&lt;p&gt;It checks that an outsider cannot access the tenant’s projects, that adding the identity as a MEMBER enables reading, and that the same member still cannot create projects. It also exercises updates, stale-write rejection, deletion, audit events, and requests without authentication.&lt;/p&gt;

&lt;p&gt;Successful completion produces:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PASS: real OIDC login, tenant isolation, membership, RBAC, CRUD, conflicts, and audit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Windows/WSL troubleshooting:&lt;/strong&gt; On my machine, Docker could not bind host port &lt;code&gt;5432&lt;/code&gt;. I changed the PostgreSQL port mapping in &lt;code&gt;compose.yml&lt;/code&gt; from &lt;code&gt;127.0.0.1:5432:5432&lt;/code&gt; to &lt;code&gt;127.0.0.1:5433:5432&lt;/code&gt;, then reran &lt;code&gt;docker compose up -d&lt;/code&gt;. The application’s internal database connection remained unchanged, and the smoke test passed.&lt;/p&gt;

&lt;p&gt;Each run creates a fictional tenant and retains its audit history. Use &lt;code&gt;docker compose down&lt;/code&gt; to stop the services while preserving the database volume.&lt;/p&gt;

&lt;p&gt;Keycloak runs in development mode and is ephemeral. Follow the README’s reset guidance if it is recreated, because identity subjects may change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test and extend the example
&lt;/h2&gt;

&lt;p&gt;For development, install JDK 25 and &lt;code&gt;unzip&lt;/code&gt;, keep Docker running, and use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./mvnw verify
python3 -m unittest discover -s scripts -p &lt;span class="s1"&gt;'test_*.py'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The documented Java verification path uses a real PostgreSQL Testcontainer. CI is configured to run verification and the Compose smoke example.&lt;/p&gt;

&lt;p&gt;To add another tenant-owned resource, follow the &lt;a href="https://github.com/chafian/spring-boot-saas-starter/blob/main/docs/extending.md" rel="noopener noreferrer"&gt;extension guide&lt;/a&gt; and preserve the membership, transaction, tenant-context, and database-policy boundaries.&lt;/p&gt;

&lt;p&gt;The current scope excludes billing, a frontend, email invitations, tenant deletion, and ownership transfer. Production deployment also requires environment-specific work such as TLS, production identity configuration, tenant-creation quotas or rate limits, backups, monitoring, and secret management. The local Keycloak setup is a development convenience.&lt;/p&gt;

&lt;p&gt;If you work with Java SaaS backends, I’d welcome feedback on the isolation model and the setup experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/chafian/spring-boot-saas-starter" rel="noopener noreferrer"&gt;Explore the repository and try the example&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>postgres</category>
      <category>security</category>
    </item>
  </channel>
</rss>
