<?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: Steven Kappel</title>
    <description>The latest articles on DEV Community by Steven Kappel (@skalpel).</description>
    <link>https://dev.to/skalpel</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%2F4265753%2F647cbcea-6c42-420c-96d4-fb8b9ce99814.png</url>
      <title>DEV Community: Steven Kappel</title>
      <link>https://dev.to/skalpel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/skalpel"/>
    <language>en</language>
    <item>
      <title>Secure AI Apps on Spring Boot: Typed Prompts with AISL, Apps as Pimi with pim-core</title>
      <dc:creator>Steven Kappel</dc:creator>
      <pubDate>Thu, 26 Nov 2026 22:32:54 +0000</pubDate>
      <link>https://dev.to/skalpel/secure-ai-apps-on-spring-boot-typed-prompts-with-aisl-apps-as-pimi-with-pim-core-1175</link>
      <guid>https://dev.to/skalpel/secure-ai-apps-on-spring-boot-typed-prompts-with-aisl-apps-as-pimi-with-pim-core-1175</guid>
      <description>&lt;p&gt;Unlike OpenClaw, &lt;a href="https://knoden.com/get-pim/?utm_source=devto&amp;amp;utm_campaign=dev-launch" rel="noopener noreferrer"&gt;Knoden PIM&lt;/a&gt; is built to be secure. Its skills aren't instructions written as informal text. Each one is a typed Java interface, so what goes to the model and what comes back is checked like any other code. Agents aren't let loose: they ask before using any tool that isn't on their allowed list. PIM is never given root access, and it only loads pimi whose checksum or signature checks out.&lt;/p&gt;

&lt;p&gt;The architecture is built on a stack developers already trust: Java, Spring, Spring AI and Ollama. And PIM is designed with developers in mind, to be extended. Its engine, &lt;strong&gt;pim-core&lt;/strong&gt;, is a set of Spring Boot libraries: an event bus, storage, security and an AI layer. Apps plug into it as &lt;strong&gt;pimi&lt;/strong&gt;, modules with their own data, logic and AI skills. The fifteen apps that come with PIM are pimi too, written to show what can be built.&lt;/p&gt;

&lt;p&gt;Every prompt in PIM goes through a small library of ours: &lt;strong&gt;&lt;a href="https://knoden.com/aisl/?utm_source=devto&amp;amp;utm_campaign=dev-launch" rel="noopener noreferrer"&gt;AISL&lt;/a&gt;&lt;/strong&gt;. It turns a prompt into a Spring bean you inject and call like any other. It's LGPL-3.0, so you can use it in any application, open or closed.&lt;/p&gt;

&lt;p&gt;This article has two parts. The first is a walk-through: from an empty project to a typed Java record filled in by a model on your own machine, then the bug that the types didn't catch and the two ways we fix that kind of bug. The second is what pim-core adds when one prompt becomes an app, and how that app is packaged and loaded as a pimi.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Java 25 and Gradle (or the wrapper).&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://ollama.com/" rel="noopener noreferrer"&gt;Ollama&lt;/a&gt;, with the default model pulled: &lt;code&gt;ollama pull gemma4&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AISL is in a public GitLab package registry, so there's no token to set up, but it isn't on Maven Central yet, so Gradle needs one repository block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// settings.gradle.kts&lt;/span&gt;
&lt;span class="n"&gt;rootProject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"aisl-demo"&lt;/span&gt;

&lt;span class="n"&gt;dependencyResolutionManagement&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;repositories&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;exclusiveContent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;forRepository&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;maven&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://gitlab.com/api/v4/projects/86960067/packages/maven"&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;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nf"&gt;includeGroup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"com.knoden.aisl"&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;mavenCentral&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="c1"&gt;// build.gradle.kts&lt;/span&gt;
&lt;span class="n"&gt;plugins&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;java&lt;/span&gt;
    &lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"org.springframework.boot"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="s2"&gt;"4.1.1"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;java&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;toolchain&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;languageVersion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;JavaLanguageVersion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;25&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;span class="n"&gt;dependencies&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;implementation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;platform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;springframework&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gradle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SpringBootPlugin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;BOM_COORDINATES&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;implementation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"org.springframework.boot:spring-boot-starter"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;implementation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"com.knoden.aisl:aisl-runtime:0.8.1"&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;That's every dependency. &lt;code&gt;aisl-runtime&lt;/code&gt; brings Spring AI and its Ollama starter.&lt;/p&gt;

&lt;h2&gt;
  
  
  A prompt is an interface
&lt;/h2&gt;

&lt;p&gt;We want to turn "Dentist this Friday from 3pm to 4pm" into an appointment. First the shape of the answer, as a plain record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;record&lt;/span&gt; &lt;span class="nc"&gt;Appointment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;end&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;Then the prompt. It's a method on an interface: the system prompt goes on &lt;code&gt;@AislPrompt&lt;/code&gt;, a &lt;code&gt;{placeholder}&lt;/code&gt; is filled from the parameter marked &lt;code&gt;@AislParam&lt;/code&gt;, and the first plain parameter is what the user typed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;AppointmentSkill&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@AislPrompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;system&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Today is {today}. Turn the user's request into one appointment. "&lt;/span&gt;
            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"Dates as YYYY-MM-DD, times as HH:MM in 24-hour time."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nc"&gt;Appointment&lt;/span&gt; &lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nd"&gt;@AislParam&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"today"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;today&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;There's no implementation. &lt;code&gt;@EnableAislSkills&lt;/code&gt; finds the interface and registers a bean for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@SpringBootApplication&lt;/span&gt;
&lt;span class="nd"&gt;@EnableAislSkills&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DemoApp&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&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="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;SpringApplication&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;DemoApp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;args&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="nd"&gt;@Bean&lt;/span&gt;
    &lt;span class="nc"&gt;CommandLineRunner&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;AppointmentSkill&lt;/span&gt; &lt;span class="n"&gt;skill&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="n"&gt;args&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;skill&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="s2"&gt;"Dentist this Friday from 3pm to 4pm"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="nc"&gt;LocalDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;" (a Wednesday)"&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;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the method returns a record and not a &lt;code&gt;String&lt;/code&gt;, the call goes through Spring AI's structured output: the model is asked for JSON matching the record, and the reply is mapped onto it. &lt;code&gt;./gradlew bootRun&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Appointment[title=Dentist, date=2026-11-30, start=15:00, end=16:00]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It compiled, it ran, every field is filled in, and the times are right. And November 30, 2026 is a Monday.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug the types didn't catch
&lt;/h2&gt;

&lt;p&gt;We ran it five times with &lt;code&gt;gemma4&lt;/code&gt;, the default. It said Friday the 27th twice. The other three times it said Monday the 30th (twice) and Friday, December 4, a week late. The record only guarantees the &lt;em&gt;shape&lt;/em&gt; of the answer. A small model is good at language and bad at calendar arithmetic, and "this Friday, given that today is Wednesday the 25th" is arithmetic.&lt;/p&gt;

&lt;p&gt;We've seen this before: in our own model tests, a small Gemma 4 put an appointment on the wrong Friday in all five runs (&lt;a href="https://knoden.com/tech/pim/ai_models/?utm_source=devto&amp;amp;utm_campaign=dev-launch" rel="noopener noreferrer"&gt;how we test the models&lt;/a&gt;). There are two ways out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. A bigger model for just this skill.&lt;/strong&gt; Every skill is a bean with a name (the interface's name, first letter lower-cased), and one property moves that skill alone to another model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="na"&gt;aisl.skill-models.appointmentSkill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;gemma4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;26b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;gemma4:26b&lt;/code&gt; it was Friday the 27th, five out of five. Everything else in the application stays on the small, fast model. That's the point of the setting: you don't move your whole application to an 18 GB model for one prompt that needs it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Don't ask the model to do arithmetic.&lt;/strong&gt; Ask it for what it's good at, which day the person meant, and let Java compute the date. The record can use real Java types; Spring AI maps them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;record&lt;/span&gt; &lt;span class="nc"&gt;Booking&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;DayOfWeek&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;LocalTime&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;LocalTime&lt;/span&gt; &lt;span class="n"&gt;end&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="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;BookingSkill&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="nd"&gt;@AislPrompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;system&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Turn the user's request into one appointment: what it is, the day of the week, "&lt;/span&gt;
            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;"and the start and end time."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nc"&gt;Booking&lt;/span&gt; &lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt; &lt;span class="n"&gt;request&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;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Booking&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;skill&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Dentist this Friday from 3pm to 4pm"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nc"&gt;LocalDate&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LocalDate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;of&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;TemporalAdjusters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nextOrSame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;day&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;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Booking[title=Dentist, day=FRIDAY, start=15:00, end=16:00] -&amp;gt; 2026-11-27
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Five out of five on the small model, and the prompt got shorter: it no longer needs today's date. &lt;code&gt;DayOfWeek&lt;/code&gt; is an enum, so the model can only name one of seven days; there's no date left for it to get wrong.&lt;/p&gt;

&lt;p&gt;We use both in PIM. The second one is the better habit: types tell you the answer has the right shape, so make the shape carry as little of the reasoning as you can.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you have more than a few prompts
&lt;/h2&gt;

&lt;p&gt;For a larger set of skills there's a second way to write them: &lt;code&gt;.aisl&lt;/code&gt; files, a short declarative format that a build-time compiler turns into the same kind of bean. An &lt;code&gt;output_schema&lt;/code&gt; block in the file also generates the Java records, and a skill can record its own model and whether a thinking model should think. The &lt;a href="https://gitlab.com/knoden/aisl-core/-/blob/main/USER_GUIDE.md" rel="noopener noreferrer"&gt;user guide&lt;/a&gt; has the format and the Gradle setup for the compiler. The interfaces above need no build step, so start there.&lt;/p&gt;

&lt;h2&gt;
  
  
  From a skill to an app: pim-core
&lt;/h2&gt;

&lt;p&gt;AISL handles one prompt. An app needs more: somewhere to keep its data, a way to talk to the rest of the system, and limits on what it and its AI may do. That is &lt;strong&gt;&lt;a href="https://knoden.com/pim-core/?utm_source=devto&amp;amp;utm_campaign=dev-launch" rel="noopener noreferrer"&gt;pim-core&lt;/a&gt;&lt;/strong&gt;, PIM's engine, published as Spring Boot libraries (&lt;code&gt;com.knoden.pim.core&lt;/code&gt;, AGPL-3.0). You take only the modules you need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Event bus&lt;/strong&gt; (&lt;code&gt;pim-events-core&lt;/code&gt;). Modules work by sending each other messages, not by calling each other. The kernel has no AI dependency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage&lt;/strong&gt; (&lt;code&gt;pim-storage-core&lt;/code&gt;). Data is kept per person. Other modules store data by sending storage a message over the bus; only storage touches the database or the disk. A file goes into the person's own folder under the app's name, and a path that could leave that folder is refused.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt; (&lt;code&gt;pim-security&lt;/code&gt;). Credentials (PBKDF2/BCrypt, lockout), crypto, an optional key store, and the encrypted backup format (AES-256-GCM).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI&lt;/strong&gt; (&lt;code&gt;pim-ai-core&lt;/code&gt;), the only module that carries Spring AI: conversations, retrieval, memory, and agents. An agent has a list of tools it may run freely. Any other tool pauses the run until the person says yes or no, and that answer covers only that one call. By default a run stops after 6 tool calls or 3 minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The pimi loader&lt;/strong&gt; (&lt;code&gt;pim-workspaces&lt;/code&gt;), below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same registry block as above, with pim-core's registry added, gets you any of them; the &lt;a href="https://knoden.com/pim-core/?utm_source=devto&amp;amp;utm_campaign=dev-launch" rel="noopener noreferrer"&gt;pim-core page&lt;/a&gt; has it.&lt;/p&gt;

&lt;h2&gt;
  
  
  An app is a pimi
&lt;/h2&gt;

&lt;p&gt;A pimi is an app packaged as a plain jar: its own classes in its own package, its own tables as Flyway migrations, and its own AISL skills. Here is Notes, PIM's simplest app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pimi.properties
db/pimi/notes/V1__notes.sql
db/pimi-grants/notes/R__notes_grants.sql
com/knoden/pim/pimi/notes/NotesPimiConfiguration.java
com/knoden/pim/pimi/notes/DefaultNotesEventService.java
com/knoden/pim/pimi/notes/NotesPersistenceEventService.java
com/knoden/pim/pimi/notes/NotesRecord.java
com/knoden/pim/pimi/notes/NotesRepository.java
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="c1"&gt;# pimi.properties
&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;notes&lt;/span&gt;
&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;Notes&lt;/span&gt;
&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;Journal&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;Quick&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;freeform&lt;/span&gt; &lt;span class="n"&gt;notes&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;anything&lt;/span&gt; &lt;span class="n"&gt;you&lt;/span&gt; &lt;span class="n"&gt;want&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;remember&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At startup pim-core's loader puts the workspace's pimi on the class path before Spring scans, so a pimi's beans are ordinary Spring beans. Nothing loads on trust:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A pimi loads only if its SHA-256 matches the one configured for it (&lt;code&gt;pim.workspaces.trusted.notes=&amp;lt;sha256&amp;gt;&lt;/code&gt;) or a publisher-signed catalog vouches for that exact build (ECDSA P-256).&lt;/li&gt;
&lt;li&gt;The loader accepts only classes in the pimi's own package (&lt;code&gt;com.knoden.pim.pimi.notes&lt;/code&gt;) and its generated skills. A library the pimi brings is relocated into its package at build time, so two pimi can't clash over a library's version.&lt;/li&gt;
&lt;li&gt;The app's code never depends on the AI stack. Its skills are &lt;code&gt;.aisl&lt;/code&gt; files, and pim-core's AI module runs them on request over the bus, on whatever model the application is configured with.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fifteen apps that come with PIM, from Notes and Calendar to Mail and Finance, are built exactly this way, in &lt;a href="https://gitlab.com/knoden/pim-apps" rel="noopener noreferrer"&gt;pim-apps&lt;/a&gt;. They are there to show what a pimi can do. Calendar books "dentist Friday at 3" for real, and it avoids the bug from part one in a third way: it gives the model the dates of the next two weeks with their weekdays, so the model looks the date up instead of working it out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rough edges
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Pre-1.0: APIs can still change between minor versions.&lt;/li&gt;
&lt;li&gt;Not on Maven Central yet, hence the repository block.&lt;/li&gt;
&lt;li&gt;Built around Ollama: the per-skill model and thinking settings are Ollama options.&lt;/li&gt;
&lt;li&gt;A method can't return &lt;code&gt;List&amp;lt;Appointment&amp;gt;&lt;/code&gt; directly; wrap the list in a record.&lt;/li&gt;
&lt;li&gt;pim-core is pre-1.0 too (0.64), and its agents are for PIM's own apps so far, not yet for pimi.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://knoden.com/aisl/?utm_source=devto&amp;amp;utm_campaign=dev-launch" rel="noopener noreferrer"&gt;AISL&lt;/a&gt;, code at &lt;a href="https://gitlab.com/knoden/aisl-core" rel="noopener noreferrer"&gt;gitlab.com/knoden/aisl-core&lt;/a&gt; (LGPL-3.0)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://knoden.com/pim-core/?utm_source=devto&amp;amp;utm_campaign=dev-launch" rel="noopener noreferrer"&gt;pim-core&lt;/a&gt;, code at &lt;a href="https://gitlab.com/knoden/pim-core" rel="noopener noreferrer"&gt;gitlab.com/knoden/pim-core&lt;/a&gt; (AGPL-3.0)&lt;/li&gt;
&lt;li&gt;PIM's apps as pimi: &lt;a href="https://gitlab.com/knoden/pim-apps" rel="noopener noreferrer"&gt;gitlab.com/knoden/pim-apps&lt;/a&gt; (AGPL-3.0)&lt;/li&gt;
&lt;li&gt;Both on one page: &lt;a href="https://knoden.com/developers/?utm_source=devto&amp;amp;utm_campaign=dev-launch" rel="noopener noreferrer"&gt;For developers&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Questions and bug reports are welcome as GitLab issues.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz6eucj9z6hftta4yey56.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz6eucj9z6hftta4yey56.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>ai</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
