Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .run/ManualTests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ManualTests" type="JUnit" factoryName="JUnit">
<module name="opendaimon-app" />
<option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="directory" />
<option name="VM_PARAMETERS" value="-ea -Dmanual.ollama.e2e=true -Dmanual.openrouter.e2e=true" />
<dir value="$PROJECT_DIR$/opendaimon-app/src/it/java/io/github/ngirchev/opendaimon/it/manual" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Handoff: module hygiene / dependency analyze / ArchUnit

Date: 2026-04-30
Project: open-daimon

## User request
Implement Maven Central readiness plan:
- minimal dependency declarations per module (`declare what you use`)
- reactor-wide `dependency:analyze`
- wire `maven-dependency-plugin:analyze-only` into `verify` with `failOnWarning=true`
- add ArchUnit boundary/layer rules
- add Maven Enforcer rules: dependency convergence, upper bounds, ban commons-logging, ban Spring Boot starters in non-app modules.

User then asked to split remaining work by module and persist state for a new session.

## Important project constraints
- Do not revert unrelated user/AI dirty changes.
- Public APIs matter. Avoid public type/method removals/renames unless explicitly approved.
- Modules are published/consumed independently; each module must declare directly-used libraries even if transitively available.
- No `@Service`, `@Component`, `@Repository` in main sources; explicit `@Bean` config only.
- Code/docs in repo must be English.

## Dirty state known before this work
Unrelated/generated files existed and should not be reverted unless user asks:
- `.serena/project.yml` modified
- docs/team files added
- various repository interfaces had `@Repository` removed by prior work
- some POMs were already partially edited

## Completed changes
### Root `pom.xml`
- Spring Boot aligned to `3.5.13`.
- Removed explicit Spring Framework BOM override.
- Updated several managed versions:
- `postgresql.version=42.7.10`
- `flyway.version=11.7.2`
- `flyway-database-postgresql.version=11.7.2`
- `jakarta-xml-bind.version=4.0.4`
- `lombok.version=1.18.44`
- `testcontainers.version=1.21.4`
- `h2.version=2.3.232`
- `maven-dependency-plugin.version=3.8.1`
- `maven-enforcer-plugin.version=3.6.2`
- `archunit.version=1.4.2`
- Added commons-logging exclusions to managed `httpclient` and `pdfbox`.
- Added pluginManagement for `maven-dependency-plugin:analyze-only` bound to `verify` with `failOnWarning=true`, `ignoreNonCompile=true`, `outputXML=true`.
- Added pluginManagement for `maven-enforcer-plugin` bound to `verify` with `dependencyConvergence`, `requireUpperBoundDeps`, and transitive banned `commons-logging:commons-logging`.
- Activated dependency/enforcer plugins in root `<build><plugins>`.

### Module POMs
- Copied dependency-cleanup baseline POMs from `../open-daimon-2` into current repo before patching further.
- Added module-local enforcer config banning transitive `org.springframework.boot:spring-boot-starter*` in non-app modules:
- `opendaimon-common`
- `opendaimon-spring-ai`
- `opendaimon-rest`
- `opendaimon-telegram`
- `opendaimon-ui`
- `opendaimon-gateway-mock`
- `opendaimon-app/pom.xml`: added `com.tngtech.archunit:archunit-junit5` test dependency and analyzer ignores for ArchUnit.
- `opendaimon-spring-ai/pom.xml`: replaced Spring AI starter runtime deps with non-starter autoconfigure deps:
- `spring-ai-autoconfigure-model-chat-memory`
- `spring-ai-autoconfigure-model-chat-memory-repository-jdbc`
- `opendaimon-common/pom.xml`: removed unused main deps reported by analyzer:
- `reactor-netty-http`
- `hibernate-validator`
- `postgresql`
- `micrometer-registry-prometheus`
- `resilience4j-spring-boot2`

### Code boundary changes
Moved direct repository access out of delivery/service clients and behind services:
- `ConversationThreadService` gained:
- `findThreads(ThreadScopeKind scopeKind, Long scopeId)`
- `closeCurrentThread(ThreadScopeKind scopeKind, Long scopeId)`
- existing `findByThreadKey` marked read-only transactional
- `OpenDaimonMessageService` gained:
- `findByThreadOrderBySequenceNumberAsc(ConversationThread thread)`
- `findByThreadAndSequenceNumberGreaterThanOrderBySequenceNumberAsc(ConversationThread thread, Integer minSequenceNumber)`
- `HistoryTelegramCommandHandler` uses `ConversationThreadService` and `OpenDaimonMessageService`.
- `ThreadsTelegramCommandHandler` uses `ConversationThreadService.findThreads`.
- `NewThreadTelegramCommandHandler` uses `ConversationThreadService.closeCurrentThread`.
- `SummarizingChatMemory` uses `ConversationThreadService` and `OpenDaimonMessageService`.
- `TelegramCommandHandlerConfig` and `SpringAIAutoConfig` wiring updated accordingly.

### Tests partially updated
- `SummarizingChatMemoryTest` updated from repository mocks to service mocks.
- Telegram handler tests were patched but not re-verified after patch due user interrupt:
- `ThreadsTelegramCommandHandlerTest`: removed repository mock and uses `threadService.findThreads`.
- `HistoryTelegramCommandHandlerTest`: uses `ConversationThreadService` and `OpenDaimonMessageService` mocks.
- `NewThreadTelegramCommandHandlerTest`: removed repository mock and verifies `closeCurrentThread`.

### ArchUnit
- Deleted old frozen `ArchitectureTest` and frozen store files:
- `opendaimon-app/src/test/resources/archunit.properties`
- files under `opendaimon-app/archunit_store/`
- Added new `opendaimon-app/src/test/java/io/github/ngirchev/opendaimon/arch/ArchitectureTest.java` with rules:
- no `@Service`, `@Component`, `@Repository` in common/springai/telegram/rest/ui main packages
- no cyclic library module dependencies
- telegram must not depend on rest
- rest must not depend on telegram
- only app/root package may depend on multiple delivery channels
- repository layer may only be accessed by service/config layers

## Verification completed before interrupt
- `./mvnw -pl opendaimon-app -am clean compile -DskipTests` passed.
- `./mvnw dependency:analyze -DskipTests` first failed on `SummarizingChatMemoryTest`; fixed.
- Re-run of `dependency:analyze -DskipTests` progressed and found module warnings before telegram test compile failure:
- `opendaimon-common`: no dependency problems at that point.
- `opendaimon-spring-ai`: unused declared warnings for:
- `org.springframework.ai:spring-ai-autoconfigure-model-chat-memory` runtime
- `org.springframework.ai:spring-ai-autoconfigure-model-chat-memory-repository-jdbc` runtime
- `com.h2database:h2` test
- `opendaimon-rest`: warnings:
- unused declared `org.hamcrest:hamcrest:test`
- non-test scoped test-only `com.fasterxml.jackson.core:jackson-core:compile`
- non-test scoped test-only `org.springframework:spring-beans:compile`
- `opendaimon-telegram`: test compile failed because handler tests still used old constructors; patched afterwards, but not re-run.
- Targeted command `./mvnw -pl opendaimon-telegram -am test -DskipITs -DskipIT -DfailIfNoTests=false` failed in upstream `opendaimon-common` tests because `hibernate-validator` had been removed and Spring configuration properties validation needs a provider at test runtime.

## Current blocker at interrupt
`opendaimon-common` tests fail with:
`jakarta.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found.`
This came from `BulkHeadPropertiesTest` loading Spring context. Likely fix: add `org.hibernate.validator:hibernate-validator` back as test-scoped dependency in `opendaimon-common`, not compile scoped, unless production module needs to provide validation provider to downstream consumers. Verify analyzer afterwards.

## Suggested module-by-module continuation plan
1. `opendaimon-common`
- Add `hibernate-validator` as test dependency or otherwise provide validation provider only for tests.
- Run: `./mvnw -pl opendaimon-common test dependency:analyze -DskipITs -DskipIT`.
- Ensure no analyzer warnings.

2. `opendaimon-spring-ai`
- Decide on analyzer handling for runtime Spring AI autoconfig glue and H2.
- If runtime autoconfig jars are intentionally present for Boot auto-configuration, add module-local `ignoredUnusedDeclaredDependencies` with precise comments.
- Remove H2 if genuinely unused, or ignore if Boot test infra loads it implicitly.
- Review `jakarta.persistence-api`: currently test scoped and compile has warnings about missing enum constants during app compile; may need compile scope if main bytecode references persistence types indirectly.
- Run: `./mvnw -pl opendaimon-spring-ai -am clean compile test dependency:analyze -DskipITs -DskipIT`.

3. `opendaimon-rest`
- Remove `org.hamcrest:hamcrest` if no direct imports.
- For `spring-beans` and `jackson-core`, either move to test scope if truly test-only, or add `ignoredNonTestScopedDependencies` if they must remain main-runtime deps. Existing comment incorrectly only handles unused-declared category.
- Run: `./mvnw -pl opendaimon-rest -am clean compile test dependency:analyze -DskipITs -DskipIT`.

4. `opendaimon-telegram`
- Re-run tests after patched constructors.
- Confirm Caffeine is declared directly because `TelegramChatPacerImpl` imports it.
- Run: `./mvnw -pl opendaimon-telegram -am clean compile test dependency:analyze -DskipITs -DskipIT`.

5. `opendaimon-ui` and `opendaimon-gateway-mock`
- Run module analyzer/enforcer separately and fix only local warnings.

6. `opendaimon-app` ArchUnit
- Run: `./mvnw -pl opendaimon-app -am test -Dtest=ArchitectureTest -Dsurefire.failIfNoSpecifiedTests=false`.
- Fix real violations, do not restore freeze store.

7. Reactor final checks
- `./mvnw clean compile`
- `./mvnw dependency:analyze -DskipTests`
- targeted ArchUnit
- `./mvnw clean verify`

## Notes for next session
- Do not keep editing globally. Finish one module at a time and verify that module before moving on.
- Watch Maven Enforcer merge behavior: module-local banned starter config may override root rules unless Maven merges as expected. Confirm with `clean verify`.
- The banned starter pattern `org.springframework.boot:spring-boot-starter*` may need to be split into `spring-boot-starter` and `spring-boot-starter-*` if enforcer does not match as intended.
- If Maven needs network and sandbox blocks it, rerun exact command with escalation per Codex instructions.
12 changes: 12 additions & 0 deletions .serena/memories/workflow/subagent_usage_preference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Subagent Usage Preference

User asked to use subagents autonomously only for larger work, especially when many modules are involved, to save main context.

Apply this rule conservatively:
- Do not spawn subagents for small, single-file, or straightforward tasks.
- Consider subagents for large multi-module changes, broad investigations, parallel verification, or independent review tracks.
- Keep delegated tasks concrete and bounded, with disjoint responsibilities where code edits are involved.
- Continue to do the immediate blocking work locally; delegate only side work that can run in parallel.
- Summarize subagent results back into the main thread instead of carrying all raw context forward.

This preference does not override Codex/developer constraints: only use subagents when the user has authorized delegation/subagent use, and avoid unnecessary delegation.
77 changes: 26 additions & 51 deletions .serena/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ project_name: "open-daimon"


# list of languages for which language servers are started; choose from:
# al bash clojure cpp csharp
# csharp_omnisharp dart elixir elm erlang
# fortran fsharp go groovy haskell
# java julia kotlin lua markdown
# matlab nix pascal perl php
# php_phpactor powershell python python_jedi r
# rego ruby ruby_solargraph rust scala
# swift terraform toml typescript typescript_vts
# vue yaml zig
# al ansible bash clojure cpp
# cpp_ccls crystal csharp csharp_omnisharp dart
# elixir elm erlang fortran fsharp
# go groovy haskell haxe hlsl
# java json julia kotlin lean4
# lua luau markdown matlab msl
# nix ocaml pascal perl php
# php_phpactor powershell python python_jedi python_ty
# r rego ruby ruby_solargraph rust
# scala solidity swift systemverilog terraform
# toml typescript typescript_vts vue yaml
# zig
# (This list may be outdated. For the current list, see values of Language enum here:
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
Expand Down Expand Up @@ -65,53 +68,17 @@ read_only: false

# list of tool names to exclude.
# This extends the existing exclusions (e.g. from the global configuration)
#
# Below is the complete list of tools for convenience.
# To make sure you have the latest list of tools, and to view their descriptions,
# execute `uv run scripts/print_tool_overview.py`.
#
# * `activate_project`: Activates a project by name.
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
# * `create_text_file`: Creates/overwrites a file in the project directory.
# * `delete_lines`: Deletes a range of lines within a file.
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
# * `execute_shell_command`: Executes a shell command.
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
# * `initial_instructions`: Gets the initial instructions for the current project.
# Should only be used in settings where the system prompt cannot be set,
# e.g. in clients you have no control over, like Claude Desktop.
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
# * `insert_at_line`: Inserts content at a given line in a file.
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
# * `list_memories`: Lists memories in Serena's project-specific memory store.
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
# * `read_file`: Reads a file within the project directory.
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
# * `remove_project`: Removes a project from the Serena configuration.
# * `replace_lines`: Replaces a range of lines within a file with new content.
# * `replace_symbol_body`: Replaces the full definition of a symbol.
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
# * `search_for_pattern`: Performs a search for a pattern in the project.
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
# * `switch_modes`: Activates modes by providing a list of their names
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
excluded_tools: []

# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
# This extends the existing inclusions (e.g. from the global configuration).
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
included_optional_tools: []

# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
fixed_tools: []

# list of mode names to that are always to be included in the set of active modes
Expand All @@ -122,11 +89,14 @@ fixed_tools: []
# Set this to a list of mode names to always include the respective modes for this project.
base_modes:

# list of mode names that are to be activated by default.
# The full set of modes to be activated is base_modes + default_modes.
# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
# list of mode names that are to be activated by default, overriding the setting in the global configuration.
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
# If the setting is undefined/empty, the default_modes from the global configuration (serena_config.yml) apply.
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
# Therefore, you can set this to [] if you do not want the default modes defined in the global config to apply
# for this project.
# This setting can, in turn, be overridden by CLI parameters (--mode).
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
default_modes:

# initial prompt for the project. It will always be given to the LLM upon activating the project
Expand All @@ -150,3 +120,8 @@ read_only_memory_patterns: []
# Extends the list from the global configuration, merging the two lists.
# Example: ["_archive/.*", "_episodes/.*"]
ignored_memory_patterns: []

# list of mode names to be activated additionally for this project, e.g. ["query-projects"]
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
added_modes:
Loading