Purpose: This document ensures continuity across development sessions by tracking lifecycle's role in the broader "Everything as Code" ecosystem.
- Name: lifecycle
- Version: v1.5.x (stable)
- Role: Foundation Layer (Infra Robustness)
- Repository: github.com/aretw0/lifecycle
Lifecycle is the foundational infrastructure layer for all "as code" projects in the ecosystem.
-
Signal Management
- Differentiate User Interrupts (SIGINT) from System Terminations (SIGTERM)
- Escalation policies (first signal = graceful, second = force)
- Cross-platform consistency (Windows CONIN$, Linux pipes)
-
Control Plane (v1.5+)
- Event-driven router (
lifecycle.Router) - Sources: OS signals, webhooks, file watches, health checks, input
- Handlers: Shutdown, reload, suspend/resume
- Middleware: Logging, recovery, metrics
- Event-driven router (
-
I/O Resilience
- Context-aware input (
lifecycle.InputSource) - Non-blocking readers (prevents signal delivery issues)
- Platform-specific handling (via
procio)
- Context-aware input (
-
Managed Concurrency
lifecycle.Gofor tracked goroutineslifecycle.Supervisorfor service orchestration- Automatic cleanup on shutdown
-
Durability Primitives
lifecycle.DoDetachedfor critical sections- Grace period enforcement
- Checkpoint hooks
Lifecycle is designed to be imported by:
- Application frameworks (Trellis, Arbour)
- CLI tools (Loam, Fiscus)
- Any Go application needing robust lifecycle management
- procio (v0.1.2): Process hygiene primitives (PDeathSig, Job Objects, termio)
- introspection (v0.1.3): Mermaid diagram generation
- ❌ Trellis (higher-level framework)
- ❌ Loam (config parsing)
- ❌ Any DSL-specific logic
Direction: Lifecycle is at the bottom of the dependency tree.
┌──────────────────────────────────────┐
│ Applications & DSLs │
│ (trellis, arbour, life-dsl, etc.) │
└────────────┬─────────────────────────┘
│ depends on
┌────────────▼─────────────────────────┐
│ Foundation │
│ - lifecycle (this project) │
│ - loam (parsing) │
│ - procio (process primitives) │
└──────────────────────────────────────┘
┌──────────────────────────────────────┐
│ Browser Domain (TS/JS) │
│ - refarm (concept transfer only) │
│ - Future: Daemon uses lifecycle │
└──────────────────────────────────────┘
- Status: Legacy integration (uses lifecycle v0.1.1)
- Usage:
lifecycle.NewSignalContextfor basic cancellation - Next Steps: Upgrade to v1.5 Control Plane (suspend/resume)
- Blocker: None (can upgrade anytime)
- ETA: 2-4 weeks
- Status: Indirect (via Trellis)
- Usage: Inherits signal handling from Trellis
- Next Steps: Wait for strategic clarity (see
ecosystem/arbour.md) - Blocker: Engine abstraction design must complete first
- ETA: TBD (deferred until Phase 3)
- Status: Independent (no dependency)
- Usage: None currently
- Next Steps: Retroactive adoption for CLI robustness
- Blocker: None (optional enhancement)
- ETA: Low priority (works fine as-is)
- Status: Greenfield (perfect for native integration)
- Usage: Planned lifecycle-first architecture
- Next Steps: Use as reference implementation
- Blocker: None
- ETA: When development starts
- Status: Concept transfer (first non-Go project)
- Usage: Architectural patterns from lifecycle ecosystem inform TS/JS design
- Integration: Future Refarm Daemon (Go) will use
lifecycle.Run()for OS-level access - Key Decision: ADR-008 — TS for browser, Go for OS daemon
- Blocker: None (concept transfer is active, code integration is future)
- ETA: Daemon development TBD (after Refarm v0.1.0)
- Docs: ecosystem/refarm.md
- Status: Not yet created (Phase 3)
- Usage: Will be primary integration showcase
- Next Steps: POC in
examples/life-dsl/ - Blocker: Waiting for
trellis-engineextraction (Phase 2) - ETA: 6-8 weeks from now
- Status: Not yet extracted (Phase 2)
- Usage: Will heavily depend on lifecycle
- Router integration for control plane
- Supervisor for worker orchestration
- Context propagation throughout engine
- Next Steps: Extract from Trellis monolith
- Blocker: Design decisions (Node abstraction, Scheduler interface)
- ETA: 4-6 weeks
Status: Complete
Lifecycle v1.5 is stable and ready for production. All planned control plane features are implemented.
- Event sources (OS signals, webhooks, file watch, health checks, input)
- Lifecycle handlers (shutdown, reload, suspend/resume)
- Managed concurrency (Go, Supervisor)
- Control router with middleware
- Platform-specific I/O (Windows CONIN$)
- Documentation & examples
- ❌ Adoption by Trellis (still on v0.1.1)
- ❌ Engine abstraction design
- ❌ Life-DSL
Goal: Separate Trellis DSL from generic execution engine.
- ✅ Control plane stable
- ✅ Supervisor API finalized
- ✅ Examples demonstrate patterns
-
trellis-enginepackage extracted - Trellis refactored to use engine
- Engine integrates lifecycle deeply:
- Uses
lifecycle.Routerfor control events - Uses
lifecycle.Supervisorfor node orchestration - Respects
lifecycle.Contextcancellation
- Uses
- Design decision needed: Node abstraction (Function vs Interface vs Hybrid)
- Recommendation: Hybrid (see
ecosystem/engine_abstraction.md) - Owner: Trellis maintainer to decide
- ETA: This week
- Recommendation: Hybrid (see
Enable multiple DSLs (flow-dsl, life-dsl, scrape-dsl) to compile to a shared execution engine, all built on lifecycle's robust foundation.
- Provide signal handling
- Provide control plane
- Provide I/O resilience
- Provide concurrency primitives
Philosophy: Lifecycle stays generic. It does not know about "flows", "workers", or "selectors". It only knows about "events", "handlers", and "goroutines".
- 3+ DSLs compile to shared engine
- Engine uses lifecycle for robustness
- All DSLs benefit from lifecycle improvements automatically
Applications use lifecycle; they don't run on it. There's no lifecycle.Main() or magic globals.
Lifecycle doesn't care if you're managing "life tasks" or "web scrapes". It only cares about shutdown, signals, and I/O.
Breaking changes are minimized. When unavoidable, follow SemVer strictly (v2.0 if needed).
All features must work on Windows (CONIN$, Job Objects, etc), not just Unix.
Metrics, introspection, and debugging hooks are core, not afterthoughts.
Each project maintains an ECOSYSTEM_INTEGRATION.md that answers:
- What does this project provide?
- What does this project consume?
- What's blocking us?
- What's the next milestone?
This allows future chat sessions to resume context instantly.
When lifecycle releases a new version:
- Update
CHANGELOG.mdwith breaking changes - Notify dependent projects via GitHub issues
- Provide migration guides in
docs/
Major architectural changes (like engine abstraction) are documented in docs/ecosystem/ before implementation.
- Document engine abstraction vision
- Update ecosystem docs (arbour.md, this file)
- Create
examples/life-dsl/POC (if trellis-engine design finalizes)
- Decide on Node abstraction (Function/Interface/Hybrid)
- Create
trellis/docs/ECOSYSTEM_INTEGRATION.md - Plan extraction roadmap in
PLANNING.md
- Create
arbour/docs/ECOSYSTEM_INTEGRATION.md - Document strategic options (plugin hub vs life-dsl merge)
- Defer active development until Phase 3
- Create
loam/docs/ECOSYSTEM_INTEGRATION.md - Document optional lifecycle adoption path
Lifecycle is stable and ready. The ecosystem now waits for:
- Trellis-engine extraction (Phase 2)
- Life-DSL POC (Phase 3)
- Clear plugin architecture emerges
This document will be updated as the ecosystem evolves.
Last Updated: 2026-03-05
Next Review: After trellis-engine v0.1.0 release or Refarm Daemon development begins