122 lines
8.2 KiB
Markdown
122 lines
8.2 KiB
Markdown
# Intentional Behavior
|
|
|
|
This document records Optimus behavior and boundaries that are deliberate. They should not be removed, generalized, centralized, or "cleaned up" without discussion about why they exist.
|
|
|
|
## Optimus is a pull framework
|
|
|
|
A desired artifact is requested at the top. Modules recursively request what they need. Work wakes up where the requested dependency chain finds missing or stale results.
|
|
|
|
Do not replace this with a centrally pushed stage sequence merely because a particular project happens to have a visually linear flow.
|
|
|
|
Ordinary module calls are allowed to be the dependency graph. A duplicate declarative DAG is not required.
|
|
|
|
A consumer normally establishes another module's artifact by ensuring it. Reading that module's persisted artifact directly in order to suppress a possible rebuild is intentionally not a second dependency mechanism. If an ensure rebuilds work that is not semantically stale, fix the owning transformer's freshness rule.
|
|
|
|
If a result is intentionally no longer evergreen, make that break explicit: publish/eject the accepted result and use the exported file as input to a separate project or graph. A frozen handoff and a live Optimus dependency are different concepts.
|
|
|
|
## Modules are broader than transformers
|
|
|
|
Optimus organizes modules.
|
|
|
|
A transformer is a module that can produce an artifact and determine whether an existing artifact remains current according to its own needs. Not every module has to produce artifacts.
|
|
|
|
Do not force service modules, human-facing modules, LLM wrappers, publishers, or other legitimate participants into an artificial transformer interface.
|
|
|
|
## Peer modules are resolved by semantic name
|
|
|
|
`settings/modules.json` is the project's composition map. Peer modules depend on one another by semantic module name and obtain one another through Optimus, normally with `utils.loadModule(name)`.
|
|
|
|
A module may freely use relative imports among private files inside its own module directory. It should not import a neighboring peer module by filesystem location. A neighboring directory that provides a real cross-module service should have a registered module identity; implementation that is private to one module should live inside that module instead.
|
|
|
|
This boundary is intentional. Optimus is the dependency resolver for peer modules, so consumers do not need to know whether a collaborator currently lives beside them in `src/`, is later extracted, or is otherwise mapped differently by the project. Avoid introducing a second peer-resolution convention based on `../some-module` paths merely because today's checkout makes that path convenient.
|
|
|
|
The current runtime reads filesystem entry paths from `settings/modules.json`. That is composition detail owned by the project mapping, not knowledge that should leak into consumers.
|
|
|
|
## Transformers may own several related transformations
|
|
|
|
Transformer is a responsibility, not a microservice size rule.
|
|
|
|
A coherent module may produce multiple artifact types or layers when those transformations genuinely belong together. Avoid both monoliths and artificial fragmentation.
|
|
|
|
## Freshness belongs to the transformer
|
|
|
|
Optimus supplies reusable mechanisms such as `resolveArtifact()` and `sameSourceHash()`. These make exact named-parent-hash freshness easy.
|
|
|
|
They are not the universal semantic definition of stale.
|
|
|
|
The owning transformer decides which inputs and rules matter to its output and is responsible for verifying those conditions before returning persisted work as current.
|
|
|
|
Do not move domain-specific invalidation policy into Optimus simply to make all transformers look identical.
|
|
|
|
Freshness sensitivity is a judgment call owned by the transformer and its pipeline. Cheap deterministic work may intentionally be highly sensitive because reconsideration costs almost nothing. Expensive or nondeterministic work may deliberately use a narrower validity contract. Hash helpers are tools, not requirements to collect every available dependency.
|
|
|
|
Artifact boundaries are likewise judgment calls. Granularity is valuable when it creates useful independent stability or clearer organization, but Optimus does not prescribe one artifact per consumer, one artifact per source node, or maximum fragmentation.
|
|
|
|
## Content hashes contain propagation
|
|
|
|
Children key off parent content identity, not the fact that the parent happened to rerun.
|
|
|
|
When a parent is rebuilt from a changed recipe but produces identical semantic content, downstream artifacts may remain current.
|
|
|
|
This is intentional and particularly important for expensive or nondeterministic work.
|
|
|
|
## Artifact storage is a workbench and warehouse
|
|
|
|
Artifact folders are intended to be useful to humans.
|
|
|
|
Do not replace readable artifact organization with opaque hash-only cache directories or structures that require special tooling merely to locate a known result.
|
|
|
|
Metadata should support provenance and freshness while leaving the actual work discoverable.
|
|
|
|
## Artifacts may have many kinds of producers
|
|
|
|
An artifact may be produced by deterministic code, an LLM, a human, an imported external source, or a combination.
|
|
|
|
Optimus does not require a generic human-task system or LLM subsystem to permit those producers. The responsible module owns the interaction and validity semantics.
|
|
|
|
## Side effects do not become semantic inputs automatically
|
|
|
|
Reasoning traces, request transcripts, timing, retries, token counts, diagnostics, and progress information can be valuable to keep. They are not semantic dependencies merely because they were generated during the work.
|
|
|
|
Do not make semantic artifacts depend on side-effect files unless their content has genuinely become part of the transformation's meaning.
|
|
|
|
## Settings are domain-agnostic
|
|
|
|
`getSettings(name)` gives Optimus projects a simple shared settings mechanism. Optimus does not interpret arbitrary setting content.
|
|
|
|
Do not add schemas, typed configuration domains, or framework ownership of settings that belong to modules without concrete evidence that the simple JSON model has failed.
|
|
|
|
## Presentation is reporting only
|
|
|
|
Optimus recognizes `presentation.showOnEnsure` and `presentation.showOnBuild`. Missing settings default to quiet ensure checks and visible actual builds. `resolveArtifact()` reports these decisions automatically; custom-validity transformers may call `reportEnsure()` / `reportBuild()` without owning console policy.
|
|
|
|
These settings and reporting hooks do not participate in artifact identity, freshness, ancestry, or persistence. Application-owned presentation settings may coexist in the same settings object and are ignored by Optimus.
|
|
|
|
`setArtifactOutcome()` remains as a compatibility reporting hook; it is also non-semantic.
|
|
|
|
## Module initialization is free
|
|
|
|
Current modules are initialized at project startup. A module may use initialization merely for setup or may synchronously establish substantial working state when its real responsibility requires that. Optimus does not impose a "lightweight init" rule.
|
|
|
|
Do not introduce lifecycle restrictions, lazy-loading machinery, or async conventions merely to make modules look uniform.
|
|
|
|
## Blocking flow is intentional
|
|
|
|
The project family intentionally targets synchronous, blocking batch execution. Promise-aware behavior that exists today supports legacy callers pending a separate unwind; it is not the desired public programming model. Do not add concurrency or Promise-driven orchestration as an optimization.
|
|
|
|
## Catalog-wide cleanup is explicit and pull-derived
|
|
|
|
Optimus may reconstruct the live graph from every current named target in
|
|
`settings/artifacts.json` for maintenance (`--vacuum`). This temporary graph
|
|
is not a replacement for normal pull execution and is not persisted as a
|
|
second dependency graph. Any meaningful artifact reached through the current
|
|
pull graph remains in the warehouse regardless of its regeneration cost.
|
|
|
|
Vacuum verification is read-only. If any current target is stale, requires a
|
|
build, or cannot be inspected, vacuuming aborts. Custom transformers must
|
|
expose the result of their own freshness check through the Optimus inspection
|
|
hook before invoking nondeterministic work. Diagnostic reporting is not
|
|
semantic evidence of reachability. The dry-run plan belongs in disposable
|
|
side-effects; apply independently recomputes and validates the plan before
|
|
removal. This is an opt-in maintenance operation, never automatic deletion.
|