Unlike OpenClaw, Knoden PIM 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.

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, pim-core, is a set of Spring Boot libraries: an event bus, storage, security and an AI layer. Apps plug into it as pimi, 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.

Every prompt in PIM goes through a small library of ours: AISL. 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.

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.

What you need

  • Java 25 and Gradle (or the wrapper).
  • Ollama, with the default model pulled: ollama pull gemma4.

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:

// settings.gradle.kts
rootProject.name = "aisl-demo"

dependencyResolutionManagement {
    repositories {
        exclusiveContent {
            forRepository {
                maven { url = uri("https://gitlab.com/api/v4/projects/86960067/packages/maven") }
            }
            filter { includeGroup("com.knoden.aisl") }
        }
        mavenCentral()
    }
}
// build.gradle.kts
plugins {
    java
    id("org.springframework.boot") version "4.1.1"
}

java { toolchain { languageVersion.set(JavaLanguageVersion.of(25)) } }

dependencies {
    implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
    implementation("org.springframework.boot:spring-boot-starter")
    implementation("com.knoden.aisl:aisl-runtime:0.8.1")
}

That’s every dependency. aisl-runtime brings Spring AI and its Ollama starter.

A prompt is an interface

We want to turn “Dentist this Friday from 3pm to 4pm” into an appointment. First the shape of the answer, as a plain record:

public record Appointment(String title, String date, String start, String end) {
}

Then the prompt. It’s a method on an interface: the system prompt goes on @AislPrompt, a {placeholder} is filled from the parameter marked @AislParam, and the first plain parameter is what the user typed:

public interface AppointmentSkill {

    @AislPrompt(system = "Today is {today}. Turn the user's request into one appointment. "
            + "Dates as YYYY-MM-DD, times as HH:MM in 24-hour time.")
    Appointment parse(String request, @AislParam("today") String today);
}

There’s no implementation. @EnableAislSkills finds the interface and registers a bean for it:

@SpringBootApplication
@EnableAislSkills
public class DemoApp {

    public static void main(String[] args) {
        SpringApplication.run(DemoApp.class, args);
    }

    @Bean
    CommandLineRunner run(AppointmentSkill skill) {
        return args -> System.out.println(skill.parse(
                "Dentist this Friday from 3pm to 4pm",
                LocalDate.of(2026, 11, 25) + " (a Wednesday)"));
    }
}

Because the method returns a record and not a String, 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. ./gradlew bootRun:

Appointment[title=Dentist, date=2026-11-30, start=15:00, end=16:00]

It compiled, it ran, every field is filled in, and the times are right. And November 30, 2026 is a Monday.

The bug the types didn’t catch

We ran it five times with gemma4, 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 shape 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.

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 (how we test the models). There are two ways out.

1. A bigger model for just this skill. 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:

aisl.skill-models.appointmentSkill=gemma4:26b

With gemma4:26b 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.

2. Don’t ask the model to do arithmetic. 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:

public record Booking(String title, DayOfWeek day, LocalTime start, LocalTime end) {
}

public interface BookingSkill {

    @AislPrompt(system = "Turn the user's request into one appointment: what it is, the day of the week, "
            + "and the start and end time.")
    Booking parse(String request);
}
Booking b = skill.parse("Dentist this Friday from 3pm to 4pm");
LocalDate date = LocalDate.of(2026, 11, 25).with(TemporalAdjusters.nextOrSame(b.day()));
Booking[title=Dentist, day=FRIDAY, start=15:00, end=16:00] -> 2026-11-27

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

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.

When you have more than a few prompts

For a larger set of skills there’s a second way to write them: .aisl files, a short declarative format that a build-time compiler turns into the same kind of bean. An output_schema 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 user guide has the format and the Gradle setup for the compiler. The interfaces above need no build step, so start there.

From a skill to an app: pim-core

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 pim-core, PIM’s engine, published as Spring Boot libraries (com.knoden.pim.core, AGPL-3.0). You take only the modules you need:

  • Event bus (pim-events-core). Modules work by sending each other messages, not by calling each other. The kernel has no AI dependency.
  • Storage (pim-storage-core). 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.
  • Security (pim-security). Credentials (PBKDF2/BCrypt, lockout), crypto, an optional key store, and the encrypted backup format (AES-256-GCM).
  • AI (pim-ai-core), 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.
  • The pimi loader (pim-workspaces), below.

The same registry block as above, with pim-core’s registry added, gets you any of them; the pim-core page has it.

An app is a pimi

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:

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
...
# pimi.properties
id=notes
name=Notes
type=Journal
description=Quick, freeform notes for anything you want to remember.

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:

  • A pimi loads only if its SHA-256 matches the one configured for it (pim.workspaces.trusted.notes=<sha256>) or a publisher-signed catalog vouches for that exact build (ECDSA P-256).
  • The loader accepts only classes in the pimi’s own package (com.knoden.pim.pimi.notes) 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.
  • The app’s code never depends on the AI stack. Its skills are .aisl files, and pim-core’s AI module runs them on request over the bus, on whatever model the application is configured with.

The fifteen apps that come with PIM, from Notes and Calendar to Mail and Finance, are built exactly this way, in pim-apps. 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.

Rough edges

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

Questions and bug reports are welcome as GitLab issues.