Modular foundations. Agentic applications.

One modular Java stack for CLI, desktop and server. Governed AI agents when you are ready.

Moduligence is an open-source framework for building enterprise applications from modules. Write a capability once and ship it in a command-line tool, a Swing or JavaFX app, or a Spring Boot or OSGi server. Add AI agents that act with the user's permissions and ask before they change anything.

Apache 2.0 open source Java 17+ Runs fully offline
A Moduligence application drawn as a stack: a host platform, the module runtime, nine modules, and an optional AI plane above themYour hostCommand lineModule runtimeApache Felix (OSGi)Your modulesServices, REST, screens, toolsOptional AIAgents that follow your rules
This build ships
  • LicenseApache 2.0, free for commercial use
  • PlatformJava 17+ and Apache Maven
  • HostsCLI, Swing, JavaFX, Spring Boot, OSGi
  • AI modelsLocal Gemma, OpenAI, Anthropic, Google
  • DeploymentOn-premises and air-gapped
One stack, every surface

Build a feature once. Ship it as a command-line tool, a desktop app or a server.

CLI, desktop and server applications share one module model, one set of APIs, one build and one way to package and launch. Teams learn a single stack, modules move between products, and AI is a choice you make per application.

Command line

Tools, batch jobs and operator utilities. Calls run synchronously, modules load from local files, and nothing web-related comes along.

moduligence-host-cli-serviceloadermoduligence-host-cli-osgi-felix

Desktop

Swing and JavaFX applications. Module work runs on a bounded background worker and results return on the UI thread, so the interface never freezes.

moduligence-host-desktop-swing-*moduligence-host-desktop-javafx-*

Server

Spring Boot 4 services and OSGi servers. Versioned REST APIs with OpenAPI documentation and browser request protection. On OSGi, also a start page and live module updates.

moduligence-host-spring-*moduligence-launcher

In the repository's examples, the CLI, Swing and JavaFX hosts load the very same greeting and text-statistics modules. Each host starts with either, both or neither, and reports a missing service instead of failing.

What stays the same everywhere

  • One module formatA module is a JAR: Java services plus, if you want them, REST APIs, screens, AI tools and knowledge.
  • One set of contractsPlain Java service interfaces and a JDK-only caller context. No OSGi, Spring or servlet types leak into your host APIs.
  • One composition choiceStandard Java ServiceLoader for simplicity, or embedded Apache Felix when modules must be installed and replaced at runtime.
  • One build and delivery pathAn Apache Maven plugin and BOM, self-contained offline images, and verified executable JARs.
  • One optional AI layerAnnotated services stay ordinary services until an application adds the AI runtime. The same tools then work on every host.

Pick a host, then a composition

Every host comes in both variants. Switching later changes a dependency, not your modules.

HostStandard Java SPIEmbedded OSGi
CLI…-host-cli-serviceloader…-host-cli-osgi-felix
Desktop worker…-host-desktop-serviceloader…-host-desktop-osgi-felix
Swing…-desktop-swing-serviceloader…-desktop-swing-osgi-felix
JavaFX…-desktop-javafx-serviceloader…-desktop-javafx-osgi-felix
Spring Boot…-host-spring-serviceloader…-host-spring-osgi-felix
+ AI, any hostAdd the agent runtime and a model provider
Optional AI, governed by design

Three questions stop most enterprise agents before production. Moduligence answers them in the architecture.

Asked by security
“Who allowed the agent to do that?”

The user, through permissions they already have.

Agents never get an account of their own. Every tool runs with the signed-in caller's identity and is authorized by your code, exactly like a REST call. Model output and documents cannot widen what that user may do.

Asked by compliance
“Where did our data go?”

Only where your policy sent it.

Every model is declared local, internal or external. External AI is off by default. Once enabled, your policy inspects the whole conversation before each provider call, including answers returned by other agents.

Asked by operations
“What if it gets it wrong?”

Nothing changes until a person says yes.

Reads run automatically. Writes stop for an explicit Approve or Deny showing the exact Java method and arguments. Uncertain writes are never retried, and operators can see and cancel any running response.

One request, step by step

See what happens between a question and a change.

An operations admin asks the built-in assistant to clean up stale contractor accounts. Try both answers on the approval card.

AI assistant · dana.ops, Operations admingemma-4-E2B-it · local
Disable contractor accounts that haven't signed in since 1 June.
Call treeresponse r-7f3a
1model turnLocalgemma-4-E2B-it · 612 tokens
2tools_search "accounts"Discovery3 tools visible to this caller
3accounts:find_usersRead-only{"text":"contractor"} → 2 users, ran automatically
4accounts:disable_userWaiting{"id":"u-20417"} · held for approval
Approve this change?Mutation
accounts:disable_user
com.acme.accounts.Accounts#disableUser
{ "id": "u-20417" }
Waiting for your decision. Nothing has changed yet.
  1. Runs on a local model

    This deployment allows only local and intranet models, so the conversation never leaves your network. Each model turn shows where it ran.

  2. Sees only what the user may use

    Discovery lists the tools and knowledge this caller is allowed to see. Administrator-only tools stay hidden from everyone else.

  3. Reads run on their own

    Read-only tools execute automatically, inside your authorization code, with the caller's identity.

  4. Changes wait for a person

    The card shows the module, the Java method and the exact arguments. Deny means the method is never called.

Adding AI to a module

From an existing service to a governed agent capability in four steps.

No separate AI platform and no second copy of your business logic. A module ships its tools, knowledge and APIs inside the same JAR as the code they describe.

Mark the methods agents may use

Annotate methods on an existing service. Parameters become validated JSON arguments, and each tool declares whether it only reads or makes a change. Your domain code keeps the authorization it has today.

Accounts.javamodule: accounts
@Component(service = Accounts.class)
@AgentTools
public final class Accounts {

  @Tool(description = "Find users by name", effect = READ_ONLY)
  public List<User> findUsers(CallContext caller,
      @ToolParam("Part of the name") String text) {
    return domain.find(caller, text); // your authorization
  }

  @RequireAdministrator
  @Tool(description = "Disable a user account", effect = MUTATION)
  public Disabled disableUser(CallContext caller,
      @ToolParam("User ID") String id) {
    return domain.disable(caller, id);
  }
}

Ship knowledge and specialist agents as Markdown

Reference material goes in META-INF/moduligence/knowledge/ as plain Markdown, searched and read on demand. Specialist agent profiles sit beside it in META-INF/moduligence/agents/; other agents can hand them a task. Protected content comes from a Java service that checks permissions on every read.

META-INF/moduligence/agents/reviewer.mdaccounts:reviewer
# Reviewer

Reviews user accounts for inconsistent or stale
data and reports what it finds.

Check each account the task names. Report
problems only; never change data.

Decide which models may see which data

The default policy permits local and intranet models and denies external ones. To use an external provider, supply a policy. It approves each destination and inspects the full conversation before every call.

DisclosurePolicy.javaimplements ModelPolicy
public boolean allows(CallContext caller, ModelTarget target) {
  return target.location() != EXTERNAL
      || caller.find(ExternalAiConsent.class).isPresent();
}

public void checkDisclosure(CallContext caller,
    ModelTarget target, String conversation) {
  if (target.location() == EXTERNAL
      && classifier.isRestricted(conversation))
    throw new SecurityException("Restricted data stays internal");
}

Deploy on the host you already run

The same module works in your CLI, desktop or server build. With OSGi, install or replace it while the application runs; stop it and its tools, knowledge and APIs disappear from the next request.

shelloffline launch, JDK only
# release/ is a self-contained image: lib/, bundles/<level>/, conf/
java -cp '/opt/acme/release/lib/*' \
  net.moduligence.launcher.LauncherMain \
  --image /opt/acme/release \
  --instance /var/acme/production
Business value, engineering substance

What the business gets, and how engineering delivers it.

Every promise maps to a specific mechanism in the framework. Your architects can verify each one in the source.

One skill set for every product

Command-line, desktop and server products share modules and know-how. Less to learn, hire for and maintain.

Under the hoodA runtime-neutral host core with ServiceLoader and Apache Felix variants for CLI, desktop, Swing, JavaFX and Spring Boot.

Agents act as the user

No privileged robot account to audit. An agent can do exactly what the person asking could do.

Under the hoodTools receive the caller's CallContext. Authority keys are reserved, so application code, model text and HTTP input cannot forge them.

People approve every change

Automation with a human checkpoint. Reviewers see the precise operation before it runs.

Under the hoodTools declare READ_ONLY or MUTATION. Approvals use single-use, owner-bound IDs; the plain JSON endpoint refuses mutations.

Data residency by design

Start with on-premises models. External AI stays off until you decide which data may use it.

Under the hoodEach model is declared LOCAL, INTERNAL or EXTERNAL. A host policy checks the conversation before every provider call.

No model vendor lock-in

Change providers as prices and capabilities move, without rewriting applications.

Under the hoodOne provider interface: LiteRT-LM for local Gemma, OpenAI, Anthropic and Google over HTTP, plus LangChain4j and Spring AI adapters.

Reuse instead of rebuild

Services you have already tested become AI tools, REST APIs and screens from one implementation.

Under the hoodAgent tools and @ModuleApi REST endpoints call the same domain service under the same caller, with per-module OpenAPI.

AI never endangers the host

A busy or failing model cannot take down the application it serves, and costs stay bounded per request.

Under the hoodBounded concurrency with a fast, retryable 503 instead of queueing; limits on time, tokens, tool calls and context; models load on first use.

Oversight for operators

Operations can see what every agent is doing right now, and stop it.

Under the hoodEvery response has an ID and a call tree of turns, tool calls and delegations. Administrators list live activity and cancel it.

Ships to restricted networks

Deploy to air-gapped sites, plants and regulated data centers with no internet access at runtime.

Under the hoodA JDK-only launcher runs portable images offline. Selections are pinned by SHA-256 and executable JARs verify their contents.

Use cases

Where teams put it to work first.

Each scenario is assembled from capabilities that ship with Moduligence today.

Product families

One codebase for tool, desktop and server editions

Same pricing engine in the batch CLI, the sales desktop app and the web API.

Each edition selects its host and modules. Business logic is written and tested once.

A CLI build never pulls in a web server or AI engine.
Software vendors

An extensible product platform

“Create a purchase order from this supplier quote.”

Partners ship modules that add tools, knowledge, REST APIs, start-page entries and screens. The assistant can use a new module as soon as it is active.

Deny any module by ID; stopped modules lose access at once.
Back-office operations

Account and access housekeeping

“Find contractor accounts idle since June and disable them.”

The agent searches and reads on its own, then queues each change for review. A reviewer agent can double-check first.

Every change waits for an explicit approval.
Banking, insurance, public sector

Policy and procedure assistant

“What is our retention period for claim documents in Germany?”

Answers come from your own procedures, filtered by each reader's current permissions, on a model inside your network.

Uses only documents the asker may read.
Platform operations

Runtime diagnostics on request

“Why isn't the payments module active?”

The optional diagnostics module gives administrators read-only tools for bundles, components, configuration and health checks.

Never starts bundles or changes configuration.
Field and desktop

Offline assistants in desktop apps

“Draft the inspection report from today's readings.”

Swing and JavaFX applications use a local model on the laptop, with work kept off the UI thread.

Works without a network; startup never waits for the model.

Prompts, names and identifiers on this page are illustrative examples.

Architecture

Your application stays in charge. Every layer above it is a choice.

You own the main method, the UI, authentication and the data. Moduligence supplies the module runtime and the capabilities you select, and nothing else.

Optional AIadd per application
Agent runtimeAssistant UILiteRT-LMOpenAIAnthropicGoogleLangChain4jSpring AI
Capabilitiesselect what you ship
REST + OpenAPISwagger UIBrowser CSRF/CORSStart pageWeb filesDiagnostics
Your modulesone JAR each
Java servicesREST APIsScreensAI toolsKnowledge
Module runtimechoose one per app
Java ServiceLoaderorEmbedded Apache Felix (OSGi)
Your hostowns UI, auth, data
CLISwingJavaFXSpring Boot 4Apache Sling

Nothing arrives by accident

Optional integrations are separate Maven artifacts. A CLI distribution never acquires a web server, admin console, REST adapter or AI engine through a transitive dependency.

Standards, not a new container

Modules are ordinary OSGi bundles wired by Declarative Services and Config Admin, or plain ServiceLoader providers. They need no Moduligence-specific interface.

One domain service, many front doors

REST endpoints, agent tools and screens call the same Java service under the same caller, so business rules live in one place.

Clear trust boundaries

Model output, documents and delegated answers are untrusted data. Modules are trusted in-process code; isolating untrusted extensions is a job for the process, container or OS, and the documentation says so.

Specifications

Built to be operated, reviewed and maintained.

License
Apache License 2.0
Java
17 minimum, compiled with --release 17; Java 21 LTS for virtual threads
Build
Apache Maven 3.9, bnd-based bundle plugin, BOM for corporate parent POMs
Module runtime
Java ServiceLoader or embedded Apache Felix
Hosts
CLI, Swing, JavaFX, Spring Boot 4, Apache Sling
Local AI
LiteRT-LM with Gemma 4 E2B by default, loaded on first use
Remote AI
OpenAI Responses, Anthropic Messages, Google GenerateContent; LangChain4j and Spring AI adapters
Distribution
Offline portable images, SHA-256 pinned selections, verified executable JAR
Release legal
LICENSE, NOTICE and THIRD-PARTY.txt assembled from the JARs actually shipped

Safe defaults you can tune

SettingDefault
External model destinationsdenied
Concurrent agent responses, then 5032
Delegation depth, including the root4
Agent request body32 MiB
Agent request timeout120 s
Attachments per message16
Cross-origin browser requestsnone

Quality gates on every build

Error ProneSpotBugs + FindSecBugsPMDOWASP Dependency-Check

Complexity, coupling and parameter limits are declared in the build and enforced as failures. Integration tests run against a real Apache Felix framework and packaged bundles.

Apache 2.0Business-friendly open source · SPDX Apache-2.0
  • Use it in commercial and proprietary products, internally or in what you sell.
  • Modify it freely, with no obligation to publish your changes.
  • Receive an explicit patent license from every contributor.
  • When you redistribute, keep the license and NOTICE and mark files you changed.
Business-friendly open source

Adopt it without a procurement cycle.

Moduligence is licensed under the Apache License 2.0, a permissive license most enterprise legal teams have already reviewed. There is no copyleft and no field-of-use restriction.

The release tooling helps you meet your own obligations: it collects license texts from every shipped component and fails the build when one is missing.

Project status: version 0.1, pre-release

The architecture and its guarantees are documented in the repository. APIs may change before 1.0, so pin versions and follow the release notes.

Start with one module.

Run the examples: the same two modules in a CLI, a Swing app and a JavaFX app, plus Spring Boot plugins. Then expose two methods of a service your users rely on and watch the assistant use them under your rules.

Build from source · Java 17, Apache Maven 3.9
$ mvn clean install
[INFO] Moduligence ............................ SUCCESS