Give legacy Java/Spring systems governed AI capabilities. A Spring Boot starter that connects your existing systems to KeelBase as governed AI tools — delegated identity, proxy-tool export, and compensation endpoints. Apache-2.0.
KeelBase is an open-source Enterprise AI Trust Runtime. With this starter, your existing Java/Spring REST endpoints become AI tools: the AI operates your real data under KeelBase governance — row-level permissions, human confirmation for writes, tamper-evident audit chains, and revocable side effects.
0.1.7 is production-wiring ready: access health self-check, zero-boilerplate tool export, three reference projects (CRM / PM / Approval), local debug script, and a Boot 2 / Java 8 path. We're inviting integrators to trial it and report back — every report shapes the 1.0 API freeze. 0.1.7 已具备生产接入能力:接入健康度自检、零样板工具导出、3 个参考项目(CRM / PM / Approval)、本地调试、Boot 2 / Java 8 适配。欢迎集成商试用反馈,反馈将决定 1.0 API 冻结。
- 5-minute trial: clone →
mvn install→ runkeelbase-java-example→node scripts/verify-java-local.mjs(接入自检) - Reference projects: CRM · PM · Approval — real Java systems wired to governed AI tools
- Customer scenario — legacy Java CRM × LangChain4j agent 客户对接样板: one-page topology + phased PoC plan → internal solution · customer-facing copy(在 KeelBase 主仓 integrator-kit)
- Full path: Development Guide(从零接入的开发使用手册)
- Feedback: open a GitHub Issue — what blocked you, what's missing, what felt awkward.
- Delegated identity (
DelegationAuthFilter): verifies the delegation JWT that KeelBase attaches to forwarded calls (HS256 + audience + issuer + expiry), maps it to a local user, and injects@DelegationUser DelegationPrincipal. Works without Spring Security; auto-writes the Spring Security context when Security is on the classpath.secretandaudienceare required — the app fails fast at startup if either is missing. - Tool declaration + export (
@KeelbaseTool): annotate your@RestControllermethods, andGET /keelbase/proxy-tools/exportproduces theai_proxy_toolsconfig — write it into KeelBase Settings to register the tools. Types / risk levels / parameters align with the KeelBase generator. Jackson-aware parameter extraction (inheritance,@JsonIgnore, records) and a singleaudiencesource of truth (tools falls back to delegation). - Compensation scaffold (
KeelBaseCompensationSupport): revocation endpoints for AI write side effects — delegated identity, idempotency, and audit out of the box. - Diagnostics (
GET /keelbase/status): delegation config, resolved export audience, tool count, and configuration warnings — without ever leaking the secret.
| Topic | Description |
|---|---|
| architecture | 架构与数据流总览——控制面/数据面、三条数据流(调用/写+撤销/反向)、委托身份桥 |
| development-guide | 开发使用手册——从零接入的完整开发路径(依赖/配置/工具/委托身份/补偿/自检/测试/发布) |
| quickstart | 10-minute end-to-end wiring guide |
| configuration | Full property reference + audience resolution rules |
| delegated-identity | JWT, verification, user mapping, Spring Security, row-level ownership |
| tool-declaration | Annotation, parameter extraction, type mapping, risk levels |
| compensation | Revocation call contract, idempotency, audit, multi-instance |
| client | Delegation-token lifecycle (KeelbaseClient) + audit reporting |
| reference-project-crm | Integrator Kit Reference Project: legacy Java CRM → AI CRM (real Java side) |
| tool-patterns | Recipes: pagination, filters, enum params, springdoc descriptions, class-level tools, write+revoke |
| maven-plugin | Maven 导出/注册插件(keelbase:export/register,配合热更新免重启) |
| gradle-usage | Consumer-side Gradle guide: dependency, config, versions |
| ci-integration | GitHub Actions 接入合规模板(契约测试 + 自检 + 导出门禁) |
| troubleshooting | Error codes, common mistakes, verification checklist |
| production-checklist | Hardening, secret rotation, ops monitoring before go-live |
Chinese versions live alongside each file (*.zh-CN.md).
# 1. Run the example (default 8081)
cd keelbase-java-example
mvn spring-boot:run
# 2. Diagnose the wiring (delegation config, resolved audience, tool count, warnings)
curl http://localhost:8081/keelbase/status
# 3. Export the ai_proxy_tools config
curl http://localhost:8081/keelbase/proxy-tools/export
# 4. Write it into KeelBase (PUT /settings/ai_proxy_tools, value = the exported JSON as a string); hot reload takes effect — no restartPublished to Maven Central — add cn.com.keelbase:keelbase-spring-boot-starter:0.1.7 as a dependency (0.1.0–0.1.7 live). For the development snapshot (0.1.7-SNAPSHOT), install locally once with mvn install. Release automation (the -Prelease profile + Central Portal token flow) is configured — see docs/release-central.md. Full steps in docs/quickstart.md.
keelbase:
delegation:
secret: ${KEELBASE_DELEGATION_SECRET:} # required; same as KeelBase DELEGATION_SECRET (>= 32 bytes)
audience: legacy-crm # required; must equal the ai_proxy_tools top-level audience
issuer: keelbase # optional
paths: # protected paths (rejected when no Authorization header)
- /api/compensation
tools:
base-url: http://localhost:8081 # target server root (export; baseUrl + full path convention)
# audience: legacy-crm # optional — falls back to delegation.audience
# export-enabled: true # disable the export endpoint after registration
# status-enabled: true # disable the /keelbase/status endpoint in lockdown
compensation:
ledger-size: 1024 # idempotency ledger LRU cap@RestController
@RequestMapping("/api")
public class FollowupController extends KeelBaseCompensationSupport<Map<String, Object>> {
@GetMapping("/followups")
@KeelbaseTool(name = "list_followups", description = "List follow-up tasks (read, R1 auto)")
public List<Map<String, Object>> list() { ... }
@PostMapping("/followups")
@KeelbaseTool(name = "create_followup", description = "Create a follow-up task (write, R3 needs confirmation)",
revokePath = "DELETE /api/compensation/followups/{id}")
public Map<String, Object> create(@RequestBody FollowupRequest req,
@DelegationUser DelegationPrincipal principal) { ... }
@DeleteMapping("/compensation/followups/{id}")
public ResponseEntity<?> revoke(@PathVariable Long id, HttpServletRequest request) {
return handleRevoke(request, id, store::get,
(item, subject) -> item.put("cancelled", true), "compensation.followups.revoke");
}
}| Module | Purpose |
|---|---|
keelbase-tools-annotation |
@KeelbaseTool / KeelbaseRiskLevel / @EnableKeelbaseTools |
keelbase-delegation-filter |
Delegation verification filter + user-mapping SPI + @DelegationUser |
keelbase-tools-export |
Annotation scanner + type mapping + /keelbase/proxy-tools/export |
keelbase-compensation |
Compensation scaffold + idempotency ledger + audit hook |
keelbase-client |
KeelbaseClient (delegation-token lifecycle) + audit reporting to the governance plane |
keelbase-spring-boot-autoconfigure |
Auto-configuration (all four pieces + optional Security adapter) |
keelbase-maven-plugin |
Maven plugin: mvn keelbase:export/register |
keelbase-test-support |
KeelbaseContractTest base class for JUnit contract tests in your own CI |
keelbase-java-crm-example |
Reference Project: legacy Java CRM → AI CRM (not published) |
keelbase-spring-boot-starter |
Aggregator (the only dependency you need) |
keelbase-java-example |
Example app (not published) |
- Delegation JWT:
{sub, oidcSub?, aud, iss:'keelbase', iat, exp}, HS256,DELEGATION_SECRET. ai_proxy_tools:{baseUrl, audience, tools:[{name, description, method, path, parameters, queryParams, riskLevel, revokePath}]}; read GET=R1 / write POST·PUT·PATCH·DELETE=R3; types integer/number/boolean/string (complex → string).baseUrlis the server root; toolpathis the full path (e.g./api/followups). KeelBase's ProxyTool concatenatesbaseUrl + path.- Revocation:
proxy-revokercalls the compensation endpoint (with delegated identity); it must return 2xx and be idempotent.
Either build system works (Maven is canonical for CI/release; Gradle is a parallel dev/publish path — dependencies mirror the poms):
mvn install # Maven: compiles all modules + runs JUnit
./gradlew build # Gradle (wrapper included): same reactor, all tests# with KeelBase (localhost:3000) and the example (localhost:8081) running:
node scripts/verify-java-starter-e2e.mjs --configure # export + write ai_proxy_tools (hot reload, no restart)
node scripts/verify-java-starter-e2e.mjs --verify --llm # full loop: confirmation gate -> streaming approve -> proxy write -> audit -> revoke -> compensationApache-2.0