A declarative reasoning engine for software configuration, applied to Gentoo Linux.
portage-ng is a declarative reasoning engine for large-scale software configurations like Gentoo Linux. Implemented in Prolog, an artificial intelligence programming language, it produces build plans that are formal proofs -- recording which rule justified each package and under what constraints. When no fully valid plan exists, it makes explicit assumptions and presents them as actionable suggestions as part of the plan: enabling or disabling specific USE flags, keywording specific ebuilds, unmasking packages, and so on.
- Proof-based plans with feature-term unification and constraint learning
- Multiple solutions and variant exploration
- Progressive relaxation with actionable suggestions
- Wave planning with optimal parallelism and SCC scheduling
- Builder-to-prover feedback: undeclared build dependencies discovered at build time are learned and the plan is re-derived, never patched
- Semantic search, LLM integration, distributed proving
- Portage-compatible execution and pre-upgrade snapshots
- Domain-agnostic reasoning core -- Gentoo-specific logic is a pluggable rules layer
See the full feature list and the handbook for architecture, internals, and reference documentation.
Prerequisites: SWI-Prolog >= 10.0.0, a Gentoo Portage tree.
# Build and install
make build && make install
# Pretend (dry-run) a build plan
portage-ng --mode standalone --pretend app-editors/neovim
# Interactive Prolog shell
portage-ng --mode standalone --shell
# Sync the Portage tree
portage-ng --mode standalone --syncFor the full command reference, see the
portage-ng(1) manpage.
The portage-ng handbook is available as a PDF and as individual Markdown chapters:
- Part I -- Getting Started (introduction, installation, configuration)
- Part II -- Architecture and Internals (pipeline, prover, assumptions, version domains, rules, planning, output)
- Part III -- Features (CLI, building, LLM integration, distributed proving, upstream bugs)
- Part IV -- Foundations (contextual logic programming, context terms, resolver comparison, dependency ordering)
- Part V -- Development (testing, performance, contributing)
BSD 2-Clause. See LICENSE.