AgentSkillsCN

hc-dev-orchestrator

启动并管理 Elohim P2P 框架的本地开发环境。统筹协调导体(身份/溯源)、存储(内容),以及门户(统一 API)。适用于启动开发服务器、调试服务连接,或检查栈健康状况时使用。

SKILL.md
--- frontmatter
name: hc-dev-orchestrator
description: Start and manage the Elohim P2P Framework local development environment. Orchestrates conductor (identity/provenance), storage (content), and doorway (unified API). Use when starting dev servers, debugging service connections, or checking stack health.

Elohim P2P Framework Orchestrator

This skill manages the local development stack for the Elohim Protocol. The framework combines three core components:

  • Holochain Conductor - Cryptographic identity and provenance (agent-centric)
  • elohim-storage - SQLite content database + blob storage (content-centric)
  • Doorway Gateway - Unified HTTP/WebSocket API

Note: This is a P2P framework where Holochain provides the cryptographic/agentic layer. Content lives in elohim-storage, not the DHT.

Architecture Overview

code
┌─────────────────────────────────────────────────────────────────────┐
│                    Elohim P2P Framework                              │
├─────────────────────────────────────────────────────────────────────┤
│                                                                       │
│   Angular App (4200)                                                  │
│        ↓                                                              │
│   Doorway Gateway (8888)  ←── Unified API for all services           │
│        ↓                   ↓                                          │
│   Holochain Conductor     elohim-storage (8090)                       │
│   └─ Agent identity       └─ SQLite content DB                        │
│   └─ Cryptographic         └─ Blob storage                            │
│      provenance            └─ Import API                              │
│        ↓                                                              │
│   Lair Keystore (in-process dev mode)                                │
│                                                                       │
└─────────────────────────────────────────────────────────────────────┘

Quick Start Commands

bash
cd /projects/elohim/elohim-app

# Start full stack (conductor + storage + doorway)
npm run hc:start

# Start with content seeding
npm run hc:start:seed

# Start + Angular dev server
npm run dev

# Check status
npm run hc:status

# Stop all services
npm run hc:stop

Command Reference

CommandDescription
npm run hc:startStart full stack (conductor + storage + doorway)
npm run hc:start:seedFull stack + seed sample content
npm run hc:start:conductorConductor only (debug mode, rare)
npm run hc:stopStop all services
npm run hc:resetStop + clear all data + restart
npm run hc:statusShow all service status
npm run hc:buildBuild all DNAs
npm run hc:build:allRebuild everything (DNAs + binaries)
npm run hc:seedSeed content to local stack
npm run devStart full stack + Angular dev server

Component-Specific Commands

CommandDescription
npm run storage:startStart storage service
npm run storage:start:foregroundStart storage (logs visible)
npm run storage:stopStop storage service
npm run storage:buildBuild storage binary
npm run storage:statsShow content database stats
npm run doorway:startStart doorway
npm run doorway:stopStop doorway
npm run doorway:buildBuild doorway binary
npm run doorway:logsShow doorway status

Environment Variables

VariableDefaultDescription
STORAGE_PORT8090elohim-storage HTTP port
STORAGE_DIR/tmp/elohim-storageStorage data directory
SEED_LIMIT20Items to seed with --seed flag
ADMIN_PORT(auto)Override conductor admin port

Health Checks

bash
# Full status
npm run hc:status

# Individual checks
curl http://localhost:8888/status        # Doorway (full status)
curl http://localhost:8888/health        # Doorway (quick health)
curl http://localhost:8888/db/stats      # Content database stats
curl http://localhost:8090/health        # Storage direct
curl http://localhost:8090/db/stats      # Storage DB stats

Port Reference

ServicePortProtocolDescription
Angular4200HTTPDev server (ng serve)
Doorway8888HTTP/WSUnified gateway API
Conductor App4445WebSocketHolochain app interface
Conductor AdmindynamicWebSocketSaved in .hc_ports
Storage8090HTTP/WSContent DB + blobs

Content Database

elohim-storage provides a SQLite content database:

bash
# List content
curl "http://localhost:8888/db/content?limit=10"

# Get content by ID
curl http://localhost:8888/db/content/manifesto

# List learning paths
curl http://localhost:8888/db/paths

# Get path with steps
curl http://localhost:8888/db/paths/elohim-protocol

# Database stats
curl http://localhost:8888/db/stats

Blob Storage

bash
# Upload blob
curl -X PUT "http://localhost:8090/blob/sha256-abc123" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @file.bin

# Get blob
curl http://localhost:8888/blob/sha256-abc123

# Check blob exists
curl -I http://localhost:8888/blob/sha256-abc123

Seeding Content

bash
# Quick seed (from elohim-app)
npm run hc:seed

# Or with options (from seeder directory)
cd genesis/seeder
DOORWAY_URL=http://localhost:8888 \
STORAGE_URL=http://localhost:8090 \
npx tsx src/seed.ts --limit 50

# Dry run (validate without writing)
npm run seed:dry-run

# Validate schema only
npm run seed:validate

Troubleshooting

Services Not Starting

bash
# Check what's using ports
fuser 8888/tcp 8090/tcp 4445/tcp

# Kill stuck processes
npm run hc:stop
fuser -k 8888/tcp 8090/tcp

# Fresh start
npm run hc:reset
npm run hc:start

Content Database 503 Errors

If you see 503 Service Unavailable on /db/* endpoints:

bash
# Ensure storage has ENABLE_CONTENT_DB=true
npm run storage:start:foreground
# Look for: "SQLite content database enabled"

Conductor Not Responding

bash
# Check ports file
cat ../holochain/local-dev/.hc_ports

# Test conductor
ADMIN_PORT=$(cat ../holochain/local-dev/.hc_ports | grep admin_port | grep -o '[0-9]*')
hc sandbox call --running $ADMIN_PORT list-apps

Doorway Missing Storage

bash
# Check doorway status
curl http://localhost:8888/status | jq '.storage'
# Should show: "configured": true, "healthy": true

# Restart doorway with storage
npm run doorway:stop
npm run doorway:start

Key File Locations

FilePurpose
elohim-app/scripts/hc-start.shMain startup script
elohim-app/scripts/storage-start.shStorage service startup
elohim-app/scripts/hc-build.shMulti-DNA build
holochain/local-dev/.hc_portsDynamic port configuration
holochain/target/release/elohim-storageStorage binary
doorway/target/release/doorwayDoorway binary

Multi-DNA Architecture

The Elohim hApp provides identity and provenance:

DNAPurposeZomes
lamadLearning provenancecontent_store, content_store_integrity
imagodeiIdentity/sovereigntyidentity, session
infrastructureNetwork servicesdoorway_registry

Common Workflows

Full Development Session

bash
# Start everything + Angular
npm run dev

# Or step by step
npm run hc:start
npm start

Content Development

bash
# Start stack
npm run hc:start

# Edit content in genesis/data/lamad/
# Then seed
npm run hc:seed

# Verify
curl http://localhost:8888/db/stats

Debugging Storage

bash
# Start conductor only
npm run hc:start:conductor

# Start storage in foreground (see all logs)
npm run storage:start:foreground

# In another terminal, start doorway
npm run doorway:start

Connect to Remote Environment

bash
# Dev environment
export DOORWAY_URL='https://doorway-dev.elohim.host'
export HOLOCHAIN_ADMIN_URL='wss://doorway-dev.elohim.host/admin?apiKey=dev-elohim-auth-2024'