Repository Split — Monolith to Modular (v0.0.3)¶
Executive Summary¶
Split Euxis into a small set of purpose-built repos that mirror today’s module boundaries: core runtime, gateway+adapters, CLI tools, TUI, agents/prompts, security policy, data/runtime/memory/metrics data tooling, and docs. This structure preserves developer velocity by keeping tightly-coupled surfaces together (CLI + core libs, Gateway + adapters) while enabling independent releases for UI, gateway, and tooling.
Phase 1 — Forensic Analysis¶
Dependency Mapping (evidence-based)¶
Core gravity center (shell libs):
euxis-bin/euxis.shsourcescore/lib/*.sh(core/lib/common.sh,providers.sh,agents.sh,memory.sh,session.sh,template.sh,skill-detector.sh,prompt.sh,cli.sh,dispatch.sh).Evidence:
euxis-bin/euxis.sh:74-100.
Nearly every CLI script sources
core/lib/core.sh.Evidence:
euxis-bin/euxis-*.shlist inrgresults.
Gateway depends on adapters and gateway utils:
api/src/gateway/server.pyimportsadapters.registryandgateway.utils.Evidence:
api/src/gateway/server.py:30-31.
Adapters depend on Gateway utilities:
adapters/src/adapters/slack_adapter.pyimportsgateway.utilsforpersist_messageandtimestamp.adapters/src/adapters/telegram_adapter.pyimportsgateway.utilsforpersist_messageandtimestamp.
TUI depends on crypto/src/crypto_lib and its own core:
ui/src/tui/core/services.pyimportscrypto/src/crypto_libencryption helpers.Evidence:
ui/src/tui/core/services.py:21-23.
TUI screens import
tui.coreandtui.widgetsinternally (self-contained).
Metrics are self-contained but used by tooling:
metrics/src/metrics/metrics_cli.pyimportsmetrics/src/metrics/aggregators/performance_analyzer.Evidence:
metrics/src/metrics/metrics_cli.py:19.
Verification components import metrics analyzers.
Evidence:
metrics/src/metrics/verification/evidence_framework.py:27.
Security policy is read by Gateway:
Gateway config defaults load from
~/.euxis/euxis-policy/gateway.json.Evidence:
api/src/gateway/server.py:133.
Circular Dependencies¶
No module-level circular imports were detected in Python packages (Gateway, Adapters, TUI, Metrics, crypto/src/crypto_lib). Shell scripts depend on core/lib but core/lib does not import from CLI. This yields a directed dependency graph with core/ as the root.
Data Flow (runtime)¶
Gateway writes session, approvals, audit, transcripts to
~/.euxis/data/runtime/gateway/*viaapi/src/gateway/utils.py.Cortex memory stored under
~/.euxis/data/runtime/memory/cortexand accessed byeuxis-bin/euxis-cortexandeuxis-bin/euxis-graph.Metrics recorded under
~/.euxis/metrics/events.jsonland consumed by metrics tooling.
Tests & Coverage¶
Shell tests and infra validation live under
tests/.Gateway protocol tests live under
api/src/gateway/protocol_test.py.TUI tests in
tests/unit/test_*referenceui/src/tui/screens.
Configuration & Secrets¶
Gateway policy defaults in
euxis-policy/gateway.json.Other configuration in
config/(playbooks, schemas, codex).Provider credentials are environment variables (documented in
README.md).
Git/Change Coupling (observed by structure)¶
CLI and
core/libchange together (sourced scripts).Gateway and adapters change together (import dependencies).
TUI changes mostly isolated except for shared agent registry.
Phase 2 — Target Repo Structure¶
Proposed Repositories (minimal set)¶
euxis-corePurpose: shared runtime utilities and contracts.
Contents:
core/,agents/(registry + prompts),config/(schemas).Public interface: shared shell libs, agent registry, config schemas.
Dependencies: none.
Build/deploy: N/A (library + data). CI: lint + schema validation.
Migration complexity: Medium (many dependents).
euxis-cliPurpose: CLI entrypoints and tooling.
Contents:
cli/.Public interface:
euxis-*commands.Dependencies:
euxis-core.Build/deploy: shell lint + certify subset.
Migration complexity: Medium.
euxis-gatewayPurpose: WebSocket control plane.
Contents:
api/src/gateway/.Public interface: WebSocket protocol, HTTP endpoints.
Dependencies:
euxis-core,euxis-security,euxis-adapters.Build/deploy: Docker image + health check.
Migration complexity: High.
euxis-adaptersPurpose: channel adapters.
Contents:
adapters/src/adapters/.Public interface: adapter SDK + registry.
Dependencies:
euxis-gateway(utils/contract).Build/deploy: pip/py module release.
Migration complexity: Medium.
euxis-tuiPurpose: Textual UI app.
Contents:
ui/src/tui/.Public interface:
euxis-tuiUI.Dependencies:
euxis-core,crypto/src/crypto_lib.Build/deploy: pip distribution or standalone script.
Migration complexity: Medium.
euxis-securityPurpose: security policy defaults.
Contents:
euxis-policy/.Public interface:
euxis-policy/gateway.json.Dependencies: none.
Build/deploy: static config distribution.
Migration complexity: Low.
euxis-metricsPurpose: observability tooling.
Contents:
metrics/src/metrics/.Public interface:
metrics_cli.py, metrics schemas.Dependencies:
euxis-core(optional) for shared schemas.Build/deploy: Python tool distribution.
Migration complexity: Medium.
dataPurpose: documentation + ADRs.
Contents:
docs/,mkdocs.yml.Public interface: docs site.
Dependencies: none.
Migration complexity: Low.
euxis-cryptoPurpose: Python crypto helpers.
Contents:
crypto/src/crypto_lib/.Public interface: Python package exports.
Dependencies: none.
Migration complexity: Low.
euxis-web
Purpose: TypeScript crypto packages.
Contents:
packages/crypto-lib,packages/crypto-server.Public interface: npm packages.
Dependencies: none.
Migration complexity: Low.
What Stays Together¶
Gateway + Adapters should stay close because adapters import
gateway.utilsand rely on gateway session persistence.CLI + core/lib should stay together because the CLI sources core libraries directly.
Phase 3 — Interface Contracts¶
API Contracts (Gateway)¶
WebSocket event schema:
docs/reference/gateway.md.HTTP endpoints:
api/src/gateway/server.py(/health,/approvals/*).Auth and policy defaults:
~/.euxis/euxis-policy/gateway.json.
Event Contracts¶
Gateway emits
agent,presence,tick,shutdownevents (documented in gateway docs).
Package Contracts¶
euxis-coreexports agent registry and shell libs (public API is filesystem-based entrypoints).
Data Ownership¶
Gateway owns
~/.euxis/data/runtime/gateway/*.Memory owns
~/.euxis/data/runtime/memory/cortex/*.Metrics owns
~/.euxis/metrics/events.jsonl.
Phase 4 — Migration Plan¶
Pre-migration Checklist¶
Break any circular dependencies (none detected in python modules).
Extract shared types/schemas into
euxis-core.Add contract tests for gateway config and adapter interface.
Document existing CI/CD flows.
Create empty repos with CI skeletons.
Migration Sequence¶
Extract
euxis-coreMove
core/,agents/,config/.Update consumers (CLI, Gateway, TUI) to pull from released package or submodule.
Extract
euxis-cliMove
cli/.Ensure core/lib is a dependency via checkout or package.
Extract
euxis-securityMove
euxis-policy/and update Gateway config default path.
Extract
euxis-gateway+euxis-adaptersMove
api/src/gateway/andadapters/src/adapters/into separate repos or a single repo with packages.
Extract
euxis-tuiMove
ui/src/tui/and rewirecrypto/src/crypto_libdependency.
Extract
euxis-metricsMove
metrics/src/metrics/and keep optional core schema references.
Extract
dataMove
docs/and doc tooling config.
Extract crypto packages
Split
crypto/src/crypto_lib/andpackages/*into their dedicated repos.
Git History Preservation¶
Use git filter-repo --path per repo to preserve history. Example:
git filter-repo --path gateway --path adapters --force
Phase 5 — Risk Register (Top 10)¶
Import path breakage — mitigate with contract tests and staged extraction.
Gateway/adapters coupling — keep together initially, split later.
CLI/core coupling — use packaged core with release gating.
Docs drift — centralize docs in
dataand automate sync.CI fragmentation — replicate certify gates per repo.
Version drift — use Renovate/Dependabot for cross-repo bumps.
Secrets handling — define standard env var contract for all repos.
Loss of atomic changes — use coordinated release branches.
Contract mismatch — add schema validation tests.
Developer friction — publish internal dev kit for local multi-repo workflows.
Decision Log¶
Keep Gateway + Adapters together for initial split due to direct imports in
adapters/src/adapters/*->api/src/gateway/utils.py.Keep CLI + core/lib closely coupled due to direct
sourceusage.Introduce security repo to isolate policy defaults from gateway runtime.
Extract metrics to allow independent release cadence.
Split crypto/src/crypto_lib and packages/ into dedicated repos due to different languages/toolchains.
Repository Map (ASCII)¶
[euxis-core]
|\
| \--> [euxis-cli]
| \--> [euxis-tui]
| \--> [euxis-metrics]
| \--> [euxis-gateway]
|
[euxis-security] ----> [euxis-gateway]
[euxis-adapters] ----> [euxis-gateway]
[data]
[euxis-crypto]
[euxis-web]
Extraction Commands¶
Use git filter-repo to preserve history. Example commands:
# Core
mkdir -p ${TMPDIR:-/tmp}/euxis-core && cd ${TMPDIR:-/tmp}/euxis-core
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path core --path agents --path config --force
# CLI
mkdir -p ${TMPDIR:-/tmp}/euxis-cli && cd ${TMPDIR:-/tmp}/euxis-cli
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path cli --force
# Gateway
mkdir -p ${TMPDIR:-/tmp}/euxis-gateway && cd ${TMPDIR:-/tmp}/euxis-gateway
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path gateway --force
# Adapters
mkdir -p ${TMPDIR:-/tmp}/euxis-adapters && cd ${TMPDIR:-/tmp}/euxis-adapters
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path adapters --force
# TUI
mkdir -p ${TMPDIR:-/tmp}/euxis-tui && cd ${TMPDIR:-/tmp}/euxis-tui
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path tui --force
# Metrics
mkdir -p ${TMPDIR:-/tmp}/euxis-metrics && cd ${TMPDIR:-/tmp}/euxis-metrics
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path metrics --force
# Security
mkdir -p ${TMPDIR:-/tmp}/euxis-security && cd ${TMPDIR:-/tmp}/euxis-security
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path security --force
# Docs
mkdir -p ${TMPDIR:-/tmp}/data && cd ${TMPDIR:-/tmp}/data
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path docs --path mkdocs.yml --force
# Crypto (Python)
mkdir -p ${TMPDIR:-/tmp}/euxis-crypto && cd ${TMPDIR:-/tmp}/euxis-crypto
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path crypto/src/crypto_lib --force
# Crypto packages (TS)
mkdir -p ${TMPDIR:-/tmp}/euxis-web && cd ${TMPDIR:-/tmp}/euxis-web
cp -R ${EUXIS_HOME}/.git .
git filter-repo --path packages/crypto-lib --path packages/crypto-server --force
Contract Tests (Recommendations)¶
Gateway ↔ Adapters
Validate adapter contract (
connect/receive/send/ack/disconnect).Ensure adapter emits normalized message schema used by Gateway.
CLI ↔ Core
CLI scripts should validate
core/libfunctions via smoke tests.
TUI ↔ Core
Mock
data/agents/registry.jsonand ensure TUI screens load registry.
Metrics ↔ Core
Validate metrics schema and event shape stability.
CI Templates (Minimal)¶
Python repos: lint + unit tests + packaging check
Shell repos:
shellcheck,shfmt,euxis-certify(subset)Gateway repo: unit tests + protocol test + health check
Docs repo: mkdocs build + link check
Example GitHub Actions skeleton (Python):
name: ci
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install -r requirements.txt
- run: pytest -q
Local Multi-Repo Workflow¶
Recommended patterns for developers:
git worktree: keep
euxis-core,euxis-cli,euxis-gatewaychecked out side-by-side.Path deps: point
euxis-clito../euxis-coreduring development.Feature flags: coordinate breaking changes with toggles.
Scaffold (monorepo-friendly) assets:
docs/workflows/multi-repo-workflow.mdfor day-to-day dev flow.config/multi-repo.example.jsonto define local repo URLs.euxis-ops/setup/multi-repo-dev.shto clone a local multi-repo layout.
Example worktree setup:
git clone git@github.com:org/euxis-core.git ~/dev/euxis-core
git -C ~/dev/euxis-core worktree add ../euxis-cli
Repo README Drafts (short)¶
euxis-core — shared registry, schemas, and shell libs for Euxis.
euxis-cli — command entrypoints and automation tooling.
euxis-gateway — WebSocket control plane with HTTP health endpoints.
euxis-adapters — channel adapters and adapter SDK.
euxis-tui — Textual UI application for fleet management.
euxis-security — approval and allowlist policy defaults.
euxis-metrics — observability tooling and fleet metrics schemas.
data — documentation and ADRs.
euxis-crypto — Python crypto utilities.
euxis-web — TypeScript crypto packages.