fix: complete all P3 audit findings — empty modules, docs drift, detekt, worktree

P3-1: Delete 17 empty Gradle modules (core:agents/observability/policies/stages,
      infrastructure:scheduler/security/telemetry, all 7 plugins/*, all 3
      interfaces/*). Zero source files, zero dependents, identical build.gradle
      stubs. Remove from settings.gradle. Keep .adoc spec docs as roadmap refs.
P3-2: Fix docs drift — rename :core:orchestration to :core:kernel in
      core-orchestration-submodule-spec.md, rewrite stale chat-transcript
      modules-and-spec.md as proper doc.
      (CLAUDE.md Router context isolation clarification is local-only,
       file is gitignored.)
P3-3: Reduce detekt maxIssues from 999999 to 120 (actual current count ~107).
      (CLAUDE.md detekt description updated locally; file is gitignored.)
P3-4: Remove stale locked worktree agent-a98d45277ce4b0040 (contained only
      cosmetic test style changes and an unused kotlinx-datetime dep).
This commit is contained in:
2026-05-29 01:09:22 +04:00
parent 7936251d6b
commit f7f237e29f
21 changed files with 48 additions and 389 deletions
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
+1 -1
View File
@@ -1,5 +1,5 @@
build: build:
maxIssues: 999999 maxIssues: 120
style: style:
active: true active: true
@@ -1,20 +1,20 @@
--- ---
name: "Core Orchestration Submodule Spec" name: "Core Kernel Submodule Spec"
description: "Specification for :core:orchestration execution kernel" description: "Specification for :core:kernel execution kernel"
depth: 2 depth: 2
links: ["../index.md", "./core-module-spec.md", "./core-sessions-submodule-spec.md", "./core-transitions-submodule-spec.md"] links: ["../index.md", "./core-module-spec.md", "./core-sessions-submodule-spec.md", "./core-transitions-submodule-spec.md"]
--- ---
# :core:orchestration module specification # :core:kernel module specification
version: 0.1-draft version: 0.2
status: foundational specification status: implemented (SessionOrchestrator + ReplayOrchestrator)
--- ---
# 1. purpose # 1. purpose
`:core:orchestration` is the execution kernel of correx. It coordinates the entire workflow lifecycle by composing: `:core:kernel` is the execution kernel of correx. It coordinates the entire workflow lifecycle by composing:
* session management * session management
* stage scheduling * stage scheduling
@@ -30,7 +30,7 @@ It is the "brain" that wires together all other core modules and ensures work pr
# 2. responsibilities # 2. responsibilities
`:core:orchestration` owns: `:core:kernel` owns:
* workflow execution loop * workflow execution loop
* stage scheduling and sequencing * stage scheduling and sequencing
@@ -46,7 +46,7 @@ It is the "brain" that wires together all other core modules and ensures work pr
# 3. non-responsibilities # 3. non-responsibilities
`:core:orchestration` MUST NOT own: `:core:kernel` MUST NOT own:
* domain logic (thats in events, transitions, validation, etc.) * domain logic (thats in events, transitions, validation, etc.)
* persistence * persistence
@@ -61,7 +61,7 @@ It coordinates; it does not implement lowlevel mechanics.
# 4. architectural role # 4. architectural role
`:core:orchestration` acts as: `:core:kernel` acts as:
* the toplevel orchestrator * the toplevel orchestrator
* the only component that directly calls other core modules in a defined sequence * the only component that directly calls other core modules in a defined sequence
@@ -112,7 +112,7 @@ Each iteration is a transaction in the event stream.
# 7. orchestration events # 7. orchestration events
`:core:orchestration` emits highlevel events: `:core:kernel` emits highlevel events:
* `WorkflowStarted` * `WorkflowStarted`
* `WorkflowCompleted` * `WorkflowCompleted`
+37 -274
View File
@@ -5,250 +5,37 @@ depth: 2
links: ["../index.md", "./core-module-spec.md", "../design/structure.md"] links: ["../index.md", "./core-module-spec.md", "../design/structure.md"]
--- ---
yes. and good catch — consistency matters here because the structure itself becomes architecture documentation. # Module Organization and Documentation
id standardize on nested gradle modules only: ## Module Layout
```text id="bllgjv" The project is organized into nested Gradle modules under these top-level groups:
:apps
:apps:cli
:apps:server
:core ```text
:core:events :apps — applications (cli, server, tui, worker, desktop)
:core:context :core — domain logic (events, sessions, transitions, kernel, context,
:core:validation inference, tools, artifacts, validation, approvals, router, config, risk)
:core:transitions :infrastructure — adapters (persistence, inference providers, tools, workflow, artifacts-cas)
:core:orchestration :testing — test suites (replay, contracts, kernel, integration, fixtures,
:core:artifacts projections, transitions, approvals, deterministic)
:core:sessions
:core:approvals
:core:policies
:core:tools
:core:inference
:infrastructure
:infrastructure:persistence
:infrastructure:providers
:infrastructure:tools
:interfaces
:interfaces:api
:interfaces:cli
``` ```
i would add: ## Documentation
* `:core:orchestration` Module specifications are maintained in AsciiDoc format under `docs/modules/`:
* `:core:artifacts`
* `:core:sessions`
immediately. - `docs/modules/core/` — core module specs (.adoc)
- `docs/modules/infrastructure/` — infrastructure module specs (.adoc)
- `docs/modules/apps/` — application module specs (.adoc)
- `docs/modules/testing/` — testing module specs (.adoc)
because those are foundational. These `.adoc` files are the authoritative source for module responsibilities,
without them, responsibilities leak everywhere. invariants, boundaries, and contracts.
and yes — writing specs/design docs module-by-module is the correct approach. ## Spec Template
BUT: Each module spec covers these sections:
you need two document types per module:
1. contract/spec
defines:
* responsibilities
* invariants
* boundaries
* public interfaces
* forbidden dependencies
* event ownership
* lifecycle guarantees
2. implementation/design
defines:
* concrete architecture
* classes
* flow
* persistence
* threading
* algorithms
* data structures
this separation matters a lot.
recommended documentation structure
```text id="3ktksg"
docs/
├── architecture/
│ ├── system-overview.md
│ ├── event-model.md
│ ├── replay-model.md
│ ├── context-layers.md
│ └── security-boundaries.md
├── modules/
│ ├── core-events/
│ │ ├── spec.md
│ │ └── design.md
│ │
│ ├── core-context/
│ │ ├── spec.md
│ │ └── design.md
│ │
│ ├── core-validation/
│ │ ├── spec.md
│ │ └── design.md
│ │
│ └── ...
└── decisions/
├── adr-0001-event-sourcing.md
├── adr-0002-kotlin-choice.md
└── ...
```
VERY important:
use ADRs from the beginning.
Architecture Decision Records
because you WILL forget later:
* why replay works this way
* why approvals are append-only
* why projections are disposable
* why router is isolated
future-you will otherwise rewrite old mistakes.
recommended order for specs
this order minimizes architectural drift:
1.
`:core:events`
first because:
everything depends on event semantics.
must define:
* event contracts
* causation/correlation ids
* append guarantees
* replay guarantees
* snapshotting
* versioning
2.
`:core:sessions`
defines:
* lifecycle FSM
* ownership boundaries
* session projections
* cancellation semantics
3.
`:core:transitions`
defines:
* graph execution
* rule evaluation
* deadlock/cycle handling
* retry semantics
4.
`:core:artifacts`
defines:
* artifact contracts
* lineage
* validation ownership
* immutability guarantees
5.
`:core:validation`
defines:
* layered validation pipeline
* semantic validators
* policy interaction
* approval interaction
6.
`:core:context`
probably hardest subsystem after validation.
must define:
* layering
* token budgeting
* compression contracts
* dedup semantics
* rebuild rules
7.
`:core:approvals`
must be isolated and heavily specified.
8.
`:core:orchestration`
only AFTER the primitives exist.
because orchestration composes:
* events
* transitions
* approvals
* context
* inference
9.
`:core:inference`
provider abstraction.
10.
`:core:tools`
tool contracts + receipts.
11.
infrastructure modules
ONLY after contracts stabilize.
this is important:
do NOT start with providers/tools/ui.
thats how orchestration architectures rot early.
for each module spec, define these sections
mandatory template:
```text id="n9z2y6"
1. purpose 1. purpose
2. responsibilities 2. responsibilities
3. non-responsibilities 3. non-responsibilities
@@ -266,56 +53,32 @@ mandatory template:
15. extension points 15. extension points
16. forbidden dependencies 16. forbidden dependencies
17. open questions 17. open questions
## Module Dependency Rules
``` ```
this will massively reduce ambiguity later.
especially:
“non-responsibilities”
and
“forbidden dependencies”
those prevent architecture erosion.
example:
```text id="a1qoqm"
:core:context
non-responsibilities:
- model execution
- persistence
- tool execution
forbidden dependencies:
- infrastructure modules
- websocket interfaces
- provider implementations
```
that sounds bureaucratic now.
it becomes life-saving later.
one more recommendation:
define module dependency rules EARLY.
example:
```text id="2vwe0o"
core modules may depend on: core modules may depend on:
- contracts - core:events (shared vocabulary)
- lower-level core modules - lower-level core modules
core modules may never depend on: core modules may never depend on:
- infrastructure - infrastructure
- interfaces - interfaces
- apps - apps
infrastructure modules may depend on:
- core modules
- other infrastructure modules
apps may depend on:
- core modules
- infrastructure modules
``` ```
enforce this automatically eventually with: No cross-core imports between sibling core modules (except `core:events` for
shared event types). Enforced by project convention.
* archunit ## Architecture Decision Records
* detekt custom rules
* dependency analysis plugin
because modular architectures silently decay otherwise. Major decisions are recorded under `docs/decisions/` as ADRs. See existing
records for the format.
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-5
View File
@@ -1,5 +0,0 @@
plugins {
id 'java-library'
id 'org.jetbrains.kotlin.jvm'
id 'org.jetbrains.kotlin.plugin.serialization'
}
-19
View File
@@ -18,8 +18,6 @@ include ':core:events'
include ':core:transitions' include ':core:transitions'
include ':core:context' include ':core:context'
include ':core:inference' include ':core:inference'
include ':core:stages'
include ':core:agents'
include ':core:artifacts' include ':core:artifacts'
include ':core:artifacts-store' include ':core:artifacts-store'
include ':core:validation' include ':core:validation'
@@ -27,8 +25,6 @@ include ':core:approvals'
include ':core:tools' include ':core:tools'
include ':core:router' include ':core:router'
include ':core:sessions' include ':core:sessions'
include ':core:policies'
include ':core:observability'
include ':core:config' include ':core:config'
include ':core:risk' include ':core:risk'
@@ -38,24 +34,9 @@ include ':infrastructure:inference:commons'
include ':infrastructure:inference:llama_cpp' include ':infrastructure:inference:llama_cpp'
include ':infrastructure:tools' include ':infrastructure:tools'
include ':infrastructure:tools:filesystem' include ':infrastructure:tools:filesystem'
include ':infrastructure:security'
include ':infrastructure:scheduler'
include ':infrastructure:telemetry'
include ':infrastructure:workflow' include ':infrastructure:workflow'
include ':infrastructure:artifacts-cas' include ':infrastructure:artifacts-cas'
include ':interfaces:api'
include ':interfaces:cli'
include ':interfaces:sdk'
include ':plugins:tools'
include ':plugins:validators'
include ':plugins:compressors'
include ':plugins:providers'
include ':plugins:transitions'
include ':plugins:stages'
include ':plugins:policies'
include ':testing:replay' include ':testing:replay'
include ':testing:contracts' include ':testing:contracts'
include ':testing:kernel' include ':testing:kernel'