Architecture Decision Records (ADRs)
This directory contains architecture decisions for the iDempiere CLI.
Active ADRs
Core Architecture
| ADR | Title | Status | Date |
|---|---|---|---|
| 001 | iDempiere Version Compatibility Strategy | Accepted | 2024-11-29 |
| 002 | CLI Plugin Architecture | Proposed | 2024-11-29 |
| 003 | Generator Architecture - Adopting Nx Patterns | Accepted | 2025-11-29 |
| 019 | CLI Command Structure Redesign | Proposed | 2025-12-07 |
| 028 | CLI Error Handling and Exit Codes | Proposed | 2025-12-07 |
| 029 | AI-Powered Plan Mode (Vibe Mode) | Proposed | 2025-12-07 |
| 030 | CLI Design Guidelines (clig.dev) | Proposed | 2025-12-07 |
| 048 | iDempiere AI Hub Architecture (3 Interfaces) | ✅ Implemented | 2025-12-11 |
| 055 | Tool Ecosystem Architectural Review | ✅ Implemented | 2025-12-15 |
| 057 | Project Rename to iDempiere Hub | ✅ Implemented | 2025-12-12 |
| 058 | Logging and Configuration Architecture | 🟡 Proposed | 2025-12-15 |
| 063 | Hub Storage Adapter Service | 🟡 Proposed | 2025-12-19 |
| 064 | Generator Output Directory Configuration | ✅ Accepted | 2025-12-19 |
| 065 | Credentials and Secrets Management | 🟡 Proposed | 2025-12-19 |
| 066 | Generator Output Modes (ECS/S3/GitHub) | ✅ Implemented | 2025-12-19 |
Application Dictionary
| ADR | Title | Status | Date |
|---|---|---|---|
| 004 | Enhanced Table Creation | Implemented | 2025-11-29 |
| 005 | iDempiere Migration Script Architecture | Implemented | 2025-11-30 |
| 008 | Application Dictionary Registry | Implemented | 2025-11-30 |
| 017 | AD_Element Description Management | Proposed | 2025-12-06 |
| 062 | Centralized ID Management Integration | 🟡 Proposed | 2025-12-18 |
API & Integration
| ADR | Title | Status | Date |
|---|---|---|---|
| 006 | CLI as M2M API | Implemented | 2025-11-30 |
| 007 | Plugin Implementation Plan | Implemented | 2025-11-30 |
| 009 | OpenAPI-Based REST Client | ✅ Implemented | 2025-12-06 |
| 060 | Apache Camel Integration Evaluation | ❌ Rejected | 2025-12-17 |
| 061 | OAuth2 Token Manager with Automatic Refresh | 🟡 Proposed | 2025-12-17 |
AI & MCP Integration
| ADR | Title | Status | Date |
|---|---|---|---|
| 010 | MCP Server Plugin Architecture | ✅ Implemented | 2025-12-01 |
| 011 | cloudempiere.ai Integration | Proposed | 2025-12-01 |
| 013 | LangChain4j Workflow Routing | ✅ Implemented | 2025-12-06 |
| 013-Appendix | ADR-013 Integration Analysis | - | 2025-12-06 |
| 014 | Heng Sin's idempiere-mcp Evaluation | ✅ Accepted | 2025-12-06 |
| 015 | Hybrid REST/SQL Data Tools Facade | ✅ Implemented | 2025-12-06 |
| 016 | MCP Security & Tenant Routing | Proposed | 2025-12-06 |
| 018 | Mattermost Community Knowledge Integration | Proposed | 2025-12-06 |
| 021 | RAG Architecture for Knowledge-Augmented AI | ✅ Implemented | 2025-12-07 |
| 022 | Shared Embedding Infrastructure | ✅ Implemented | 2025-12-07 |
| 023 | Quarkus LangChain4j Migration | ✅ Implemented | 2025-12-07 |
| 024 | AD Metadata Caching Strategy | Proposed | 2025-12-07 |
| 054 | AI Tool Architecture Clarity & ToolResult Unification | ✅ Implemented | 2025-12-11 |
| 056 | Chat API Cancellation and Timeout | ✅ Implemented | 2025-12-13 |
| 057 | AWS Bedrock Integration | ✅ Implemented | 2025-12-13 |
| 067 | RAG Text Sanitization and Escaping | 🟡 Proposed | 2025-12-26 |
DevOps & Deployment
| ADR | Title | Status | Date |
|---|---|---|---|
| 034 | Deployment History Tracking | Proposed | 2025-12-08 |
| 035 | Database Restore Architecture (S3) | Accepted | 2025-12-08 |
Implementation Status
| ADR | Status | Code Evidence |
|---|---|---|
| ADR-001 | ✅ Implemented | Maven profiles, IdempiereVersion.java, ADReference.java |
| ADR-002 | ⚠️ Partial | PluginCommand.java, plugin/spi/ package |
| ADR-003 | ✅ Implemented | GeneratorTree.java, GeneratorSchema.java, GeneratorRegistry.java |
| ADR-004 | ✅ Implemented | TableService.java, column templates |
| ADR-005 | ✅ Implemented | MigrationScriptCommand.java, MigrationScriptService.java |
| ADR-006 | ✅ Implemented | --json flag, JsonOutput.java |
| ADR-007 | ✅ Implemented | Plugin SPI framework |
| ADR-008 | ✅ Implemented | RegistryCommand.java, RegistryExportCommand.java |
| ADR-009 | ✅ Implemented | GeneratedOpenApiFactory.java, 21 APIs, 162 models |
| ADR-010 | ~~Superseded~~ | Replaced by ADR-013 (LangChain4j) - mcp/ code deprecated |
| ADR-011 | ❌ Not Started | Integration planned |
| ADR-013 | ✅ Implemented | AskCommand.java, CliRouterAgent.java, shared tool logic |
| ADR-014 | ✅ Accepted | Evaluation decision - not adopting Heng Sin's idempiere-mcp |
| ADR-015 | ✅ Implemented | RestDataToolLogic - hybrid REST/SQL data facade |
| ADR-016 | ❌ Proposed | SecurityGuard for MCP tenant routing and isolation |
| ADR-017 | ❌ Proposed | element describe command for AD_Element documentation |
| ADR-018 | ❌ Proposed | Mattermost community knowledge integration |
| ADR-019 | ❌ Proposed | CLI Command Structure Redesign - AI/MCP native naming |
| ADR-021 | ✅ Implemented | RagService.java, ADMetadataIngestor.java, PGVector integration |
| ADR-022 | ✅ Implemented | EmbeddingModelProvider.java, EmbeddingStoreProvider.java |
| ADR-023 | ✅ Implemented | Quarkus LangChain4j CDI, CliRouterAgent.java |
| ADR-024 | ❌ Proposed | AD metadata caching strategy (Quarkus Cache + file persistence) |
| ADR-028 | ❌ Proposed | CLI error handling with exit codes and pre-flight checks |
| ADR-029 | ❌ Proposed | AI-powered plan mode for consultants (vibe mode) |
| ADR-030 | ❌ Proposed | CLI design guidelines adopting clig.dev standards |
| ADR-034 | ❌ Proposed | Deployment history tracking with iDempiere AD + REST API |
| ADR-035 | ✅ Implemented | EnvRestoreService.java, S3BackupService.java, DockerPostgresService.java, AWS S3 + Docker |
| ADR-048 | ✅ Implemented | Hub architecture: 3 interfaces (CLI 19%, Chat API 4%, MCP 3%), 74% shared infrastructure |
| ADR-054 | ✅ Implemented | ToolResult unification (ai/shared), ToolExecutionException for Chat API |
| ADR-055 | ✅ Implemented | Connection pooling, SQL consolidation, god object refactoring (5 phases, 5 commits) |
| ADR-056 | ✅ Implemented | ChatAgentService timeout handling, graceful shutdown for streaming |
| ADR-057 | ✅ Implemented | AWS Bedrock provider support (Claude models via Bedrock) |
| ADR-057 | ✅ Implemented | Project renamed from "iDempiere CLI" to "iDempiere Hub" (artifact, docs, branding) |
| ADR-058 | 🟡 Proposed | Unified error codes (HubErrorCode), @ConfigMapping consolidation, structured logging |
| ADR-061 | 🟡 Proposed | OAuth2 token manager with automatic refresh, thread-safe access, JWT expiry validation |
| ADR-062 | 🟡 Proposed | Centralized ID Management integration for AD element creation (developer.idempiere.com) |
| ADR-063 | 🟡 Proposed | Hub Storage Adapter Service - generic key-value storage with pluggable backends |
| ADR-064 | ✅ Accepted | Generator output directory configuration with GITHUB_ROOT and GENERATOR_ROOT_DIR |
| ADR-065 | 🟡 Proposed | Credentials/secrets management with AWS Secrets Manager, Vault, environment fallback |
| ADR-066 | ✅ Implemented | Generator output modes (FILESYSTEM, ARCHIVE, URL, S3, GITHUB, EMAIL) with GeneratorOutputService |
| ADR-067 | 🟡 Proposed | RAG text sanitization: TextSanitizer.java, URL decode, null byte removal, pg_dump compatibility |
ADR Process
We follow the MADR 3.0 (Markdown Any Decision Records) format.
- Propose: Use 000-template.md to draft new ADR
- Discuss: Review with team
- Decide: Update status to Accepted/Rejected
- Implement: Link to implementation commits
- Update Index: Add to this README
ADR Format (MADR 3.0)
Each ADR includes:
- Status: Proposed, Accepted, Deprecated, Superseded
- Date: Decision date (YYYY-MM-DD)
- Deciders: People involved in the decision
- Context and Problem Statement: Problem description (required)
- Decision Drivers: Key factors influencing the decision
- Considered Options: Options evaluated (required)
- Decision Outcome: What was decided and why (required)
- Confirmation: How to verify implementation
- Pros and Cons: Analysis of each option
- More Information: Implementation details, diagrams, references
Key Decisions Summary
Core Architecture
ADR-001: iDempiere Version Compatibility
- Maven profiles for v10, v11, v12, v13, Custom Fork
- Version-aware template generation
- Field type validation by iDempiere version
- Branch-to-dependency mapping
ADR-002: CLI Plugin Architecture
- Plugin SPI (Service Provider Interface)
- GeneratorProvider, AnalyzerProvider, IntegrationProvider
- AI service abstraction (Claude, OpenAI, local)
- Directory-based plugin discovery
ADR-003: Generator Architecture (Nx Patterns)
- Virtual File System (GeneratorTree)
- Schema-driven validation (JSON schemas)
- Composable generators (invoke pattern)
- AST manipulation (JavaParser)
- Interactive prompts
ADR-019: CLI Command Structure Redesign
- Prefix-based grouping:
dev,dict,gen,pack,ide,env,server,ai,util dictfor Application Dictionary (clear name vs. ambiguousad)envfor DevOps: backup, restore, deploy, clone environments- AI/LLM native understanding with snake_case MCP tool names
- CLI-to-MCP tool mapping (e.g.,
dict table add→dict_table_add) - JSON output with
--jsonfor M2M/AI consumption - Structured error messages with suggestions for AI recovery
Application Dictionary
ADR-004: Enhanced Table Creation
- Standard column templates (audit, document, accounting)
- Auto-create Window/Tab/Fields
- Import table pattern (I_*)
- High-volume table support
ADR-005: Migration Script Architecture
- Document iDempiere's two-phase migration system
- CLI generates preview DDL, not official scripts
- 2Pack XML as primary export format
- Centralized ID management awareness
ADR-008: Application Dictionary Registry
registrycommand for AD queries- JSON export for AI/MCP consumption
- Standard patterns (document, master-data, transaction-line)
- Direct database access via JDBC
ADR-017: AD_Element Description Management
element describecommand for generating AD_Element documentation- Pattern-based generation for predictable columns (_UU, _ID, Is*, Qty*, Amt*, Date*, _Acct)
- Java code analysis to extract business logic context
- AI agent integration for complex descriptions
- Migration script generation for PostgreSQL/Oracle
- Adopts proven Python scripts from iDempiere repo
ADR-062: Centralized ID Management Integration
- Integrate with iDempiere's centralized ID server (developer.idempiere.com)
- Automatic ID allocation for AD elements based on entity type
- Support for custom implementor ID servers
- Three modes: centralized (HTTP), proxied (via iDempiere REST), local (development)
- Entity type validation and registration
- Prevents ID conflicts in distributed development teams
- Future: CloudEmpiere internal IDs via StorageAdapter (ADR-063)
ADR-063: Hub Storage Adapter Service
- Generic key-value storage interface for Hub services
- Pluggable backends: PostgreSQL (default), AWS DynamoDB, S3, In-Memory (testing)
- Namespace isolation for different concerns (ids, config, cache, state)
- Atomic sequence operations for ID generation
- Used by: CentralizedIdService (CE_* entity types), ConfigService, CacheService
- Enables CloudEmpiere-specific ID management without external server dependency
API & Integration
ADR-006: CLI as M2M API
--jsonflag for machine-readable output- Exit codes for scripting
- Batch command support
- n8n/automation integration
ADR-009: OpenAPI REST Client
- Generate type-safe client from OpenAPI spec
- Replace hand-written IdempiereClient
- 70+ endpoints coverage
- OData query parameter support
AI & MCP Integration
ADR-010: MCP Server Plugin Architecture (Superseded by ADR-013)
- Originally proposed external MCP server using MCP Java SDK
- Replaced by LangChain4j @Tool approach in ADR-013
src/main/java/org/idempiere/cli/mcp/code is deprecated
ADR-011: cloudempiere.ai Integration
- Deep iDempiere context via cloudempiere.ai plugin
- Role-based security inheritance
- Secure database query execution
- Audit trail integration
ADR-013: LangChain4j Workflow Routing
- Natural language command routing via LangChain4j
- @Tool annotations wrap existing CLI commands
- Multi-provider support (Ollama local, Claude, OpenAI)
- Offline capability with local LLMs
askcommand for AI-powered CLI interaction
ADR-014: Heng Sin's idempiere-mcp Evaluation
- Evaluated hengsin/idempiere-mcp for adoption
- Different architecture: OSGi bundle vs. embedded LangChain4j
- Decision: Not adopting - different deployment model
- Heng Sin's approach: production (inside iDempiere), ours: development (standalone)
ADR-015: REST Data Tools Facade
RestDataToolLogicfacade overGeneratedOpenApiFactory- Inspired by Heng Sin's tool patterns (ADR-014)
- Tools: searchRecords, getRecord, runProcess, listServerJobs, etc.
- Uses existing OpenAPI client (ADR-009) with LangChain4j @Tool (ADR-013)
ADR-016: MCP Security & Tenant Routing
- Hybrid security model: static config (dev) + tokens (prod)
SecurityGuardclass for centralized access control- Automatic tenant filter injection for queries
- iDempiere Data Access Level enforcement
- Multi-tenant MCP client configuration via separate tokens
ADR-018: Mattermost Community Knowledge Integration
- Read-only Mattermost API integration for knowledge extraction
- Channels: ~developers, ~support, ~plugins, ~announcements
- Tools: searchMattermost, getChannelHistory, findSimilarDiscussions
- RAG-based answers from community discussions
- Vector embeddings for semantic search of historical posts
Related Documentation
| Document | Purpose |
|---|---|
| CLAUDE.md | Project instructions for Claude Code |
| FEATURES.md | Feature matrix by version |
| USER_GUIDE.md | User documentation |
| CHANGELOG.md | Version history |
| FUNCTIONAL_COVERAGE_AUDIT.md | Coverage analysis (81%) |
| IMPLEMENTATION_PLAN.md | Phased roadmap |
| Generator Delivery System | ADR-064/065/066 consolidated guide |
iDempiere References
Wiki Documentation
- Application Dictionary
- REST Web Services
- 2Pack
- Generating Migration Scripts
- Centralized ID Management
OSGi Factory Documentation
- NF9.1 OSGi New Process Factory
- NF9.1 OSGi New Model Factory
- NF9.1 OSGi New Column Callout Factory
- NF9.1 OSGi New Form Factory
- NF9.1 OSGi New Event Handling Annotation