# nahom-zewdu/nuvom architecture

> Architecture diagram of the GitHub repository nahom-zewdu/nuvom, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nahom-zewdu/nuvom
- Repository: https://github.com/nahom-zewdu/nuvom

## Overview

1. **What this repo is**
   Nuvom is a Python task engine packaged as a library plus a CLI. The core responsibility is to let users define tasks, discover them statically, enqueue jobs, schedule recurring or delayed work, execute jobs in workers, and persist results through interchangeable storage backends.

2. **Developer-facing API surface**
   The main user API lives in `nuvom.task`, `nuvom.sdk`, `nuvom.job`, and `nuvom.result_store`. The README examples show the intended flow: decorate a function as a task, call `delay()` to enqueue a job, or `schedule()` for timed execution. These modules are the boundary between application code and the engine.

3. **Task discovery and manifest generation**
   Discovery is a distinct subsystem under `nuvom/discovery`. It uses AST-oriented parsing and file walking (`walker`, `parser`, `filters`, `reference`, `compute_path`) to find task definitions without importing arbitrary user code. Discovery writes a manifest (`.nuvom/manifest.json`) so workers can start quickly and resolve tasks consistently. This is one of the repo’s central architectural choices.

4. **Registry and task resolution**
   `nuvom/registry` and `nuvom/internal/manifest.py` provide the runtime index of discovered tasks. The registry bridges the static discovery output to execution-time lookup, so a queued job can be matched back to the correct task handler. The `auto_register` module suggests automatic registration from discovered metadata rather than manual wiring.

5. **Job lifecycle**
   Jobs are represented in `nuvom/job.py` and executed through `nuvom/execution/job_runner.py`. The typical flow is: task call creates a job object, queue backend persists it, worker fetches it, job runner executes the underlying function, then the result is handed to a result backend. Retries, timeout handling, and result storage are part of this lifecycle and are covered by dedicated tests.

6. **Queueing subsystem**
   Queue abstractions live in `nuvom/queue.py` and `nuvom/queue_backends`. There are concrete backends for memory, file, and SQLite, all built on a base interface. This is the primary durability boundary for “pending work”: the same job model can move through different persistence layers depending on deployment needs.

7. **Result persistence subsystem**
   Results are separated from queueing in `nuvom/result_backends` and `nuvom/result_store.py`. Like the queue, result storage has memory, file, and SQLite implementations with a shared base contract. That separation matters architecturally because job dispatch and job outcome retention can scale or be swapped independently.

8. **Scheduler and delayed execution**
   Scheduling is a first-class subsystem under `nuvom/scheduler`. It has its own models, dispatcher, backend abstraction, worker, and storage backends. The scheduler handles delayed, interval, and cron-style triggers and moves due jobs into the execution pipeline. In the architecture diagram, this is a parallel control plane feeding the queue, not the same thing as the worker that runs task code.

9. **Worker runtime**
   `nuvom/worker.py` and `nuvom/scheduler/worker.py` represent the execution agents. The worker consumes queued jobs, resolves them through the registry/manifest, runs them through the job runner, and writes outcomes to the result store. The scheduler worker has a narrower role: detect due scheduled work and hand it off to the queue.

10. **Plugin architecture**
   Plugins are explicit in `nuvom/plugins`, with contracts, loader, registry, and a Prometheus monitoring plugin. The repo also includes `.nuvom_plugins.toml`, which is the configuration boundary for extensions. This subsystem is how Nuvom supports custom backends, monitoring, and other operational integrations without changing core engine code.

11. **CLI as the operational entry point**
   `nuvom/cli` exposes the operator-facing commands: discover tasks, list tasks, inspect jobs, view history, manage plugins, and run workers or test workers. The CLI is the main orchestration layer for developers and operators, turning the underlying subsystems into executable workflows.

12. **Serialization, configuration, and support utilities**
   Serialization is isolated in `nuvom/serialization` with a msgpack-based serializer. Configuration and compatibility helpers live in `nuvom/config.py` and `nuvom/utils`, including TOML compatibility and safe file deletion. These are supporting layers that keep persistence and cross-version behavior predictable.

13. **How the main data flow fits together**
   The central data path is: source code task definitions → discovery/manifest → registry lookup → queue/scheduler persistence → worker execution → result storage. Scheduling inserts an additional path where timed jobs are promoted into the queue. Plugins can intercept or extend this flow, especially around storage and observability.

14. **What to emphasize in an architecture diagram**
   The key boundaries are: application tasks vs. engine internals, discovery vs. runtime execution, queue vs. result storage, scheduler vs. worker, and core engine vs. plugins. The repo is intentionally modular, with multiple backend implementations behind shared interfaces, so the diagram should show interchangeable storage and extension points rather than a single monolithic service.

Main entry points: [`nuvom/worker.py`](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/worker.py) (Worker), [`nuvom/discovery/discover_tasks.py`](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/discovery/discover_tasks.py) (Discovery), [`nuvom/registry/registry.py`](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/registry/registry.py) (Registry), [`nuvom/queue.py`](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/queue.py) (Queue API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core engine"]
  node_task_api["Task API<br/>public API<br/>[task.py]"]
  node_sdk["SDK<br/>public API<br/>[sdk.py]"]
  node_job_model["Job Model<br/>job object<br/>[job.py]"]
  node_discovery["Discovery<br/>static scan<br/>[discover_tasks.py]"]
  node_manifest["Manifest<br/>runtime index<br/>[manifest.py]"]
  node_registry["Registry<br/>task lookup<br/>[registry.py]"]
  node_auto_register["Auto Register<br/>bridge<br/>[auto_register.py]"]
  node_job_runner["Job Runner<br/>executor<br/>[job_runner.py]"]
end

subgraph group_storage["Persistence"]
  node_queue_api["Queue API<br/>durability boundary<br/>[queue.py]"]
  node_queue_backends[("Queue Backends<br/>storage adapters<br/>[base.py]")]
  node_result_store["Result Store<br/>result boundary<br/>[result_store.py]"]
  node_result_backends[("Result Backends<br/>storage adapters<br/>[base.py]")]
  node_scheduler["Scheduler<br/>control plane<br/>[scheduler.py]"]
  node_scheduler_dispatcher["Dispatcher<br/>promotion logic<br/>[dispatcher.py]"]
  node_scheduler_backend[("Scheduler Backends<br/>schedule storage<br/>[backend.py]")]
end

subgraph group_ops["Operations"]
  node_worker["Worker<br/>[worker.py]"]
  node_scheduler_worker["Sched Worker<br/>scheduler worker<br/>[worker.py]"]
  node_cli["CLI<br/>operator entrypoint<br/>[cli.py]"]
  node_plugins["Plugins<br/>extension system<br/>[contracts.py]"]
end

subgraph group_support["Support"]
  node_serialization["Serialization<br/>codec<br/>[base.py]"]
  node_config["Config<br/>support code<br/>[config.py]"]
end

node_task_api -->|"creates"| node_job_model
node_sdk -->|"builds on"| node_task_api
node_task_api -->|"discovers"| node_discovery
node_discovery -->|"writes"| node_manifest
node_manifest -->|"loads"| node_registry
node_auto_register -->|"populates"| node_registry
node_registry -->|"resolves"| node_job_runner
node_job_model -->|"enqueued via"| node_queue_api
node_queue_api -->|"implemented by"| node_queue_backends
node_job_runner -->|"stores outcome"| node_result_store
node_result_store -->|"implemented by"| node_result_backends
node_scheduler -->|"drives"| node_scheduler_dispatcher
node_scheduler_dispatcher -->|"promotes"| node_queue_api
node_scheduler -->|"persists via"| node_scheduler_backend
node_scheduler_worker -->|"runs"| node_scheduler
node_worker -->|"looks up"| node_registry
node_worker -->|"executes with"| node_job_runner
node_worker -->|"records"| node_result_store
node_cli -->|"invokes"| node_discovery
node_cli -->|"launches"| node_worker
node_cli -->|"manages"| node_plugins
node_plugins -.->|"extends"| node_result_backends
node_serialization -->|"encodes"| node_queue_api
node_serialization -->|"encodes"| node_result_store
node_config -->|"configures"| node_discovery
node_config -->|"configures"| node_plugins

click node_task_api "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/task.py"
click node_sdk "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/sdk.py"
click node_job_model "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/job.py"
click node_discovery "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/discovery/discover_tasks.py"
click node_manifest "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/discovery/manifest.py"
click node_registry "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/registry/registry.py"
click node_auto_register "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/registry/auto_register.py"
click node_job_runner "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/execution/job_runner.py"
click node_queue_api "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/queue.py"
click node_queue_backends "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/queue_backends/base.py"
click node_result_store "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/result_store.py"
click node_result_backends "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/result_backends/base.py"
click node_scheduler "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/scheduler/scheduler.py"
click node_scheduler_dispatcher "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/scheduler/dispatcher.py"
click node_scheduler_backend "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/scheduler/backend.py"
click node_worker "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/worker.py"
click node_scheduler_worker "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/scheduler/worker.py"
click node_cli "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/cli/cli.py"
click node_plugins "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/plugins/contracts.py"
click node_serialization "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/serialization/base.py"
click node_config "https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/config.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_task_api,node_sdk,node_job_model,node_discovery,node_manifest,node_registry,node_auto_register,node_job_runner toneBlue
class node_queue_api,node_queue_backends,node_result_store,node_result_backends,node_scheduler,node_scheduler_dispatcher,node_scheduler_backend toneAmber
class node_worker,node_scheduler_worker,node_cli,node_plugins toneMint
class node_serialization,node_config toneRose
```

## Components

### Core engine

Task API, discovery, registry, execution, and runtime coordination.

- [Task API](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/task.py): public API · Decorator and scheduling surface for application code. · `nuvom/task.py`
- [SDK](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/sdk.py): public API · User-facing helpers that complement the task boundary. · `nuvom/sdk.py`
- [Job Model](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/job.py): job object · Represents queued, scheduled, and executing work items. · `nuvom/job.py`
- [Discovery](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/discovery/discover_tasks.py): static scan · AST-based task discovery and manifest generation. · `nuvom/discovery/discover_tasks.py`
- [Manifest](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/discovery/manifest.py): runtime index · Persisted task metadata used for fast startup and lookup. · `nuvom/discovery/manifest.py`
- [Registry](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/registry/registry.py): task lookup · Resolves discovered tasks to runnable handlers at execution time. · `nuvom/registry/registry.py`
- [Auto Register](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/registry/auto_register.py): bridge · Loads discovered metadata into the runtime registry. · `nuvom/registry/auto_register.py`
- [Job Runner](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/execution/job_runner.py): executor · Executes job payloads and coordinates retries and outcomes. · `nuvom/execution/job_runner.py`

### Persistence

Pluggable queue, result, and scheduler backends.

- [Queue API](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/queue.py): durability boundary · Shared interface for pending work persistence. · `nuvom/queue.py`
- [Queue Backends](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/queue_backends/base.py): storage adapters · Memory, file, and SQLite queue implementations. · `nuvom/queue_backends/base.py`
- [Result Store](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/result_store.py): result boundary · Shared interface for storing job outcomes. · `nuvom/result_store.py`
- [Result Backends](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/result_backends/base.py): storage adapters · Memory, file, and SQLite result implementations. · `nuvom/result_backends/base.py`
- [Scheduler](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/scheduler/scheduler.py): control plane · Plans delayed, interval, and cron-like work. · `nuvom/scheduler/scheduler.py`
- [Dispatcher](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/scheduler/dispatcher.py): promotion logic · Moves due scheduled work toward execution. · `nuvom/scheduler/dispatcher.py`
- [Scheduler Backends](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/scheduler/backend.py): schedule storage · Memory and SQLite persistence for scheduled work. · `nuvom/scheduler/backend.py`

### Operations

CLI, plugins, and runtime entry points.

- [Worker](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/worker.py): runtime worker · Consumes queued jobs, resolves tasks, runs them, and stores results. · `nuvom/worker.py`
- [Sched Worker](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/scheduler/worker.py): scheduler worker · Detects due scheduled work and hands it off to the queue. · `nuvom/scheduler/worker.py`
- [CLI](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/cli/cli.py): operator entrypoint · Commands for discovery, inspection, workers, and plugins. · `nuvom/cli/cli.py`
- [Plugins](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/plugins/contracts.py): extension system · Contracts, loader, registry, and monitoring integrations. · `nuvom/plugins/contracts.py`

### Support

Serialization and compatibility utilities.

- [Serialization](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/serialization/base.py): codec · Msgpack-based encoding for jobs and persisted data. · `nuvom/serialization/base.py`
- [Config](https://github.com/nahom-zewdu/nuvom/blob/main/nuvom/config.py): support code · Configuration and compatibility helpers. · `nuvom/config.py`

## Connections

- Task API → Job Model: creates · Task invocation produces job records for dispatch.
- SDK → Task API: builds on · SDK helpers sit on top of the public task API.
- Task API → Discovery: discovers · Task definitions are found without importing user code.
- Discovery → Manifest: writes · Static discovery materializes a manifest for later startup.
- Manifest → Registry: loads · The manifest seeds runtime task resolution.
- Auto Register → Registry: populates · Discovered task metadata is registered automatically.
- Registry → Job Runner: resolves · Execution needs a handler lookup before running a job.
- Job Model → Queue API: enqueued via · Jobs are persisted through the queue abstraction.
- Queue API → Queue Backends: implemented by · Pending work can live in memory, files, or SQLite.
- Job Runner → Result Store: stores outcome · Completed execution writes to the result boundary.
- Result Store → Result Backends: implemented by · Results can be persisted through interchangeable backends.
- Scheduler → Dispatcher: drives · The scheduler determines which work is due.
- Dispatcher → Queue API: promotes · Due scheduled jobs are handed into the queue.
- Scheduler → Scheduler Backends: persists via · Scheduled work state is stored behind backend contracts.
- Sched Worker → Scheduler: runs · A dedicated worker processes schedule-side control flow.
- Worker → Registry: looks up · Workers resolve queued jobs to task handlers.
- Worker → Job Runner: executes with · Worker runtime delegates execution to the job runner.
- Worker → Result Store: records · Worker execution outcomes are persisted as results.
- CLI → Discovery: invokes · CLI exposes task discovery and listing operations.
- CLI → Worker: launches · CLI can run workers and test workers.
- CLI → Plugins: manages · CLI surfaces plugin inspection and scaffolding commands.
- Plugins → Result Backends: extends · Plugins can add or alter operational backends and integrations.
- Serialization → Queue API: encodes · Queued jobs are serialized for persistence and transport.
- Serialization → Result Store: encodes · Stored outcomes use the shared serialization layer.
- Config → Discovery: configures · Discovery and repo scanning are guided by configuration.
- Config → Plugins: configures · Plugin loading and extension settings come from config.
