How saatsky/hierarchy_pai works
Hierarchical Planner AI is a Phoenix LiveView application for turning a user goal into a reviewed, dependency-aware plan, executing steps in parallel with specialist agents, and synthesizing the results. The UI also supports saved/imported plans, skills, model and specialist overrides, recovery, and live progress. MCP provides both an inbound tool endpoint and optional outbound tools for step execution. The main workflow is documented in the README; sampled source confirms the web routing, MCP bridge, synchronous pipeline wrapper, and supervised in-memory stores. Unsampled internals are represented only where documented.
Main entry points: planner_live.ex Planner UI · executor.ex Step executor · orchestrator.ex Wave orchestrator · router.ex Web router
Components 23
Web interaction
- Planner UI
lib/hierarchy_pai_web/live/planner_live.ex - Web router
lib/hierarchy_pai_web/router.ex - UI components
lib/hierarchy_pai_web/components/core_components.ex
Plan and execute
- Planner agent
lib/hierarchy_pai/agents/planner.ex - Specialist registry
lib/hierarchy_pai/agents/agent_registry.ex - Wave orchestrator
lib/hierarchy_pai/orchestrator.ex - Step executor
lib/hierarchy_pai/agents/executor.ex - Result aggregator
lib/hierarchy_pai/agents/aggregator.ex - Task runner
lib/hierarchy_pai/pipeline/task_runner.ex - Task discovery
lib/hierarchy_pai/pipeline/discovery.ex - Domain handling
lib/hierarchy_pai/pipeline/domain.ex
Configuration and state
- LLM provider
lib/hierarchy_pai/llm_provider.ex - Provider settings
lib/hierarchy_pai/provider_store.ex - Saved plans
lib/hierarchy_pai/plan_store.ex - Run state
lib/hierarchy_pai/run_store.ex - Skill packages
lib/hierarchy_pai/skill_store.ex
MCP interfaces
- MCP server registry
lib/hierarchy_pai/mcp_server_store.ex - MCP client
lib/hierarchy_pai/mcp_client.ex - Synchronous pipeline
lib/hierarchy_pai/pipeline/pipeline_runner.ex - MCP endpoint
lib/hierarchy_pai_web/plugs/mcp_router.ex
Other components
- User
- MCP-compatible agent
- LLM services
Connections 26
- User → Planner UI: submits goal
- Web router → Planner UI: routes UI
lib/hierarchy_pai_web/router.ex - Planner UI → Planner agent: requests plan
- Planner agent → Specialist registry: assigns specialists
- Planner UI → Saved plans: saves and loads
- Planner UI → Skill packages: assigns skills
- Planner UI → Wave orchestrator: starts execution
- Wave orchestrator → Step executor: dispatches steps
- Step executor → Specialist registry: uses specialist
- Step executor → Skill packages: uses skill
- Step executor → MCP client: calls step tools
- Step executor → LLM provider: builds model
lib/hierarchy_pai/llm_provider.ex - LLM provider → LLM services: calls provider
- Wave orchestrator → Result aggregator: synthesizes outputs
- Result aggregator → LLM provider: builds model
lib/hierarchy_pai/llm_provider.ex - Planner UI → Provider settings: configures providers
- Planner UI → Run state: tracks progress
- Planner UI → UI components: renders UI
- MCP-compatible agent → Web router: calls MCP endpoint
- Web router → MCP endpoint: forwards MCP
lib/hierarchy_pai_web/router.ex - MCP endpoint → Synchronous pipeline: dispatches tools
- Synchronous pipeline → Wave orchestrator: starts pipeline
lib/hierarchy_pai/pipeline/pipeline_runner.ex - Synchronous pipeline → Run state: updates run
lib/hierarchy_pai/pipeline/pipeline_runner.ex - MCP client → MCP server registry: uses server config
- Task discovery → Task runner: supports task flow
- Domain handling → Task runner: supports task flow