fix 4 core services as needed by hero_rpc #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Meeting Minutes
Topic: HERO Services Architecture – OpenRPC Standardization
Participants: Kristof (Speaker 1), Timur (Speaker 2)
Date: Not specified (transcribed meeting)
1. Objective
The meeting focused on simplifying and standardizing the architecture of core AI and data services within the HERO ecosystem.
Key goals:
This will reduce complexity and make the platform easier to extend and maintain.
2. Core Services to Implement
Four core services will form the base infrastructure layer.
Core Services
Clarifications:
Together they enable:
These primitives are sufficient to support agentic data workflows.
3. Strict OpenRPC Compliance
All four services must:
This ensures:
4. Initialization and Runtime (
zinit)The initialization mechanism mentioned in the meeting refers to zinit, which will act as the runtime service manager.
Responsibilities of
zinit:Conceptual structure:
All services should:
5. Service Startup Model
Instead of fragile scripts or Makefiles, services should self-start through the server binary.
Example:
This command should automatically:
For now, this may run inside screen sessions or similar simple runtime environments.
Later this will integrate with Hero OS service orchestration.
6. SDK Improvements
The SDK should provide helper utilities to simplify service development.
Possible additions:
This will reduce repeated code across services while maintaining strict architecture.
7. Service Dependency Model
Dependencies:
All communication happens via OpenRPC calls.
8. Future Integration with Hero RPC
Once these four services are implemented and stable, Hero RPC will integrate them.
Generated OpenRPC services will automatically gain access to:
Architecture concept:
This enables agentic functionality directly in generated services.
9. Development Branch Strategy
All development should be done in dedicated branches.
Suggested branch names:
ai-brokerembedderindexerredisEach service should follow the same schema structure and OpenRPC generation approach.
10. Immediate Action Items
Core Implementation
Standardization
SDK Work
Infrastructure
Implementation Plan: Zinit Lifecycle Migration for 4 Core Services
Context
Per hero_rpc#7,
OServer::run_cli()now provides standardized CLI subcommands (start/stop/run/status/logs/ui/zinit) with zinit lifecycle management viaZinitLifecycle(Pattern B —ZinitRPCAPIClient). The 4 core services need to adopt this same CLI pattern.Current State
hero_aibroker_openrpc--bind <socket>hero_embedder_serverZinitHandle+ServiceConfigBuilder)--startflaghero_indexer_serverzinit add-service--dir,--sockethero_redis_serverzinit add-service--socket,--data-dir,--port, etc.Migration Approach
These services use custom RPC implementations (not OSIS), so they can't use
OServer::run_cli()directly. Instead, each service will:zinit_sdk(fromgeomind_code/zinit,development_kristofbranch) andclapdependenciesServerCli/ServerCommandfrom hero_rpcZinitLifecycle-equivalent code forstart/stop/status/logs/ui/zinitsubcommandsrunsubcommand with service-specific argsPer-Service Plan
1. hero_aibroker (
hero_aibroker_openrpc)main()intorun_server()underrunsubcommandrunaccepts--bind <socket>(existing arg)startregisters with zinit, exec =<binary> run2. hero_embedder (
hero_embedder_server)zinit = { version = "0.3.9" }withzinit_sdk--startflag +ZinitHandle/ServiceConfigBuildercoderunsubcommand calls existingrun_server()startusesZinitLifecyclePattern B3. hero_index_server (
hero_indexer_server)zinit_sdkdependency--dirand--socketunderrun4. hero_redis (
hero_redis_server)zinit_sdkdependencyrunrun)startpasses relevant args to zinit exec commandCLI Pattern (Same for All)
Dependencies
Reference
OServer::run_cli()implementationcrates/server/src/server/lifecycle.rs:ZinitLifecyclereferenceVerification: Zinit Lifecycle Migration Complete
All 4 core services have been migrated to the standardized zinit lifecycle CLI pattern (Pattern B —
ZinitRPCAPIClient).Changes Pushed
development_standardize0c273a0hero_aibroker_openrpcdevelopment144af04hero_embedder_serverdevelopmentc33d249hero_indexer_serverdevelopment464b33ehero_redis_serverBuild Verification
All 4 services compile clean (
cargo checkpasses with zero errors):CLI Verification
All 4 services show identical CLI interface:
What Changed
zinit_sdkdep + lifecycle module. Old--bindarg moved underrunsubcommand.zinit = 0.3.9(Pattern A,ZinitHandle) withzinit_sdk(Pattern B). Removed--startflag, added 7 subcommands.zinit_sdkdep + lifecycle module. Old--dir/--socketargs moved underrunsubcommand.zinit_sdkdep + lifecycle module. All existing args (--socket,--data-dir,--port,--encryption-key,--admin-pubkey,--admin-secret,--verbose) preserved underrunsubcommand. Multi-protocol (RESP2 + JSON-RPC) unchanged.Pattern Used
Each service has:
lifecycle.rs— Self-containedZinitLifecyclestruct usingZinitRPCAPIClientCli/Commandmatching theServerCli/ServerCommandpattern fromhero_rpc_serverrunsubcommand — Contains all existing server logicstart/stop/status/logs— Delegated toZinitLifecycleMakefile Note
Existing Makefile targets (
make run, etc.) still work but should be updated to use the new CLI pattern:make run→<service> run(dev mode)make service→<service> start(zinit-managed)make stop→<service> stopBest practice established: zinit-only lifecycle for all Hero binaries
After implementing this in hero_os, we've converged on these conventions that should apply to all repos adopting zinit lifecycle:
1. No standalone/direct mode
All server binaries run exclusively through zinit. The
runsubcommand exists only as the internal entry point that zinit invokes — developers never call it directly.2.
cargo updatebeforestartmake startmust runcargo updatefirst to pick up latest git dependency changes (e.g. hero_rpc fixes). This prevents stale dependency bugs.3.
make run= start + stream logs + stop on Ctrl-CFor developer experience,
make runshould:This gives devs the feel of running directly while getting zinit's process management.
4. HTTP/UI crates also use ZinitLifecycle
Not just OpenRPC servers — the HTTP static-file server (
hero_os_ui) also usesZinitLifecyclefromhero_rpc_server. Any binary that should be supervised gets the same treatment.5. Makefile pattern
Implemented in hero_os (hero_os#12) and hero_rpc#7. Apply same pattern to AI Broker, Embedder, Indexer, Redis services.
Zinit Lifecycle Convention Standardized
The CLI subcommand naming for all hero_rpc-based servers is now finalized:
runstartstopservestatus/logsFor OpenRPC servers (OServer pattern)
Use
OServer::run_cli()— handles all subcommands automatically. Therun_fncallback is only invoked forserve.For non-OpenRPC servers (e.g. HTTP/UI servers)
Use
ZinitLifecycledirectly with your own clap CLI:Makefile best practice
No Makefile-level log polling —
ZinitLifecycle::run()handles everything.Applied in
hero_os_server(OpenRPC) andhero_os_ui(HTTP, uses ZinitLifecycle directly)Action for other repos
Any repo with a hero_rpc-generated server should adopt this convention:
hero_rpc(cargo update)ZinitLifecyclewith theRun/Servepattern shown aboveZinit Lifecycle Serve Rename — Applied to All 4 Repos
The serve rename convention has been applied to all 4 service repos:
Changes per repo
All repos received identical structural changes:
CLI subcommands renamed:
run→ Developer command (start via zinit + stream logs + stop on Ctrl-C)serve→ Internal (what zinit invokes to run the actual server process)start→ Start via zinit in backgroundstop/status/logs/ui/zinit— unchangedlifecycle.rs updated:
exec_command()now generates{binary} serve(was{binary} run)run()method (start + poll logs + Ctrl-C stop)~/hero/var/sockets/zinit_server.sockMakefile updated:
make run→cargo run -p <server> -- run(zinit-managed, streams logs)make start→cargo run -p <server> -- start(background)make stop→cargo run -p <server> -- stopmake rundev→cargo run -p <server> -- serve(direct, no zinit)Repos & commits
development_standardize415ac19development0351b0ddevelopmentf3ae5d6developmentabecd5fReference pattern
Follows the hero_os (development_timur) reference implementation and hero_rpc commit
9d338ad.zinitfor lifecycle and development #7