Portfolio Manager is the application layer on top of portfolio_core and portfolio_index. It provides CLI workflows, RAG query interfaces, graph tooling, and manifest-driven configuration for managing code portfolios.
Add the dependency in mix.exs:
def deps do
[
{:portfolio_manager, "~> 0.3.1"}
]
endThen:
mix deps.get- Manifest-driven adapter wiring (vector store, graph store, embedder, LLM, chunker)
- RAG queries with multiple strategies (hybrid, self-rag, graph-rag, agentic)
- Graph utilities for dependency and knowledge graphs
- CLI tasks for ask/search/index/graph operations
- Runnable examples under
examples/
Route LLM requests across multiple providers with intelligent strategies:
# Automatic routing
{:ok, response} = PortfolioManager.Router.complete(messages)
# Force specific strategy
{:ok, response} = PortfolioManager.Router.complete(messages, strategy: :specialist)
# Route by task type
{:ok, response} = PortfolioManager.Router.complete(messages, task_type: :code)
# Stream responses
PortfolioManager.Router.stream(messages, &IO.write/1)Stream RAG query responses for better UX:
PortfolioManager.RAG.stream_query("How does this work?", fn chunk ->
IO.write(chunk)
end)
# CLI
mix portfolio.ask "Your question" --streamUse tool-based agents for complex tasks:
PortfolioManager.Agent.run("Analyze this codebase and suggest improvements",
tools: [:search_code, :read_file, :get_graph_context]
)Build complex workflows with dependency management:
import PortfolioManager.Pipeline
run(:analysis, %{repo: "/path/to/repo"}) do
step :scan, &scan_files/1
step :analyze, &analyze/1, depends_on: [:scan]
step :report, &generate_report/1, depends_on: [:analyze]
endmix deps.get
mix compile
# Start the app
iex -S mixManifests live in config/manifests/ and select adapters per environment.
Set environment variables for API keys and graph connections as needed:
export GEMINI_API_KEY=your-key
export ANTHROPIC_API_KEY=your-key
export OPENAI_API_KEY=your-key
export NEO4J_URI=bolt://localhost:7687
export NEO4J_USER=neo4j
export NEO4J_PASSWORD=password# Ask a question (RAG + LLM)
mix portfolio.ask "How does the workflow engine process steps?"
# Search without generation
mix portfolio.search "authentication flow" --index default --k 5
# Index a repository
mix portfolio.index . --index portfolio_manager --extensions .ex,.exs,.md
# Graph stats
mix portfolio.graph stats --graph defaultExamples assume the development manifest plus Postgres/pgvector and Neo4j. Run the PortfolioIndex migrations before trying the RAG scripts:
mix ecto.create -r PortfolioIndex.Repo
mix ecto.migrate -r PortfolioIndex.RepoSee examples/README.md for runnable scripts, adapter notes, and the
examples/run_all.sh runner.
MIT License - see LICENSE for details.