This repo is the “one folder to open in VS Code.” It keeps the PeTTa runtime, the MORK kernel, PathMap, and the MeTTa/MM2 tooling side-by-side so the editor (and its Language Server Protocol clients) can see every dependency without juggling multiple clones. The SWI-Prolog LSP server that powers MeTTa/MM2 authoring lives under upstreams/metta-wam/libraries/lsp_server_metta, and VS Code picks it up through the shared .config/swi-prolog/pack tree created by scripts/link_toolchains.sh. Because PeTTa itself is mostly SWI-Prolog, we also vend and install James Cash’s lsp_server pack so VS Code gets hover/completion/diagnostics when editing MeTTa source files or the underlying Prolog runtime. With everything wired through a single devcontainer, you can hack on MeTTa programs, run the LSP-backed IDE features, and jump into upstream sources to expand or debug the stack—all without leaving this workspace.
For recent changes and outstanding tasks, see CHANGELOG.md.
- upstreams/PeTTa/README.md – authoritative docs for the SWI-Prolog runtime, FFI glue, and example workflows.
- upstreams/MORK/README.md – details on the MORK kernel layout, CLI usage, and PathMap integration.
- upstreams/PathMap/README.md – background on the PathMap crate, feature flags, and build requirements.
- upstreams/metta-wam/README.md – documentation for the MeTTa WAM tooling plus the bundled
lsp_server_mettapack. - upstreams/metta-wam/libraries/lsp_server_metta/README.md – the MeTTa-specific LSP glue that wires the SWI-Prolog pack into the workspace.
- .local/share/swi-prolog/pack/lsp_server/README.md – James Cash’s general-purpose SWI-Prolog LSP server used for PeTTa source editing.
We'll track future TODO items for this workspace here (and out of CHANGELOG.md). Add entries as they are defined.
- Support running VS Code inside the
petta-devcontainer with host X11 forwarding (e.g., exportingDISPLAY/WAYLAND_DISPLAYand sharing the socket or using VS Code Server) so GUI launches from inside Docker render on the host—this likely means bundling the VS Code binaries in the image. - Stand up a SWISH service inside the container and expose it to the host (via forwarded ports or an nginx proxy) so users can hit the Prolog playground without leaving Docker.
- Provide a first-class way to launch the MeTTaWamJam server (host or Docker) so contributors can demo the web UI without manual scripts.
- Install Visual Studio Code (the devcontainer already ships everything else).
- Run
./scripts/install_prolog_lsp_pack.shto mirror the vendoredjamesnvc/lsp_serverclone into.config/swi-prolog/packand.local/share/swi-prolog/pack, then rebuild the pack viaswipl -g pack_rebuild/1. The script expects you have already run./scripts/bootstrap_repos.shsoupstreams/lsp_serverexists, and it reuses the same pack tree inside the repo thatscripts/link_toolchains.shsyncs to your home directory. - Run
./scripts/setup_metta_lsp.shto package the MeTTa LSP extension. It checks fornode/npm, runsnpm install, buildsmetta-lsp-*.vsixvianpx vsce package, and prints the generated filename. SetINSTALL_VSIX=trueto have it callcode --install-extensionautomatically, or runcode --install-extension <path>yourself if you prefer. - The script can also start the SWI-Prolog server: export
START_SERVER=true(and optionallyPORT=NNNN) to spawn it viaswipl. Point the extension at the running port by disablingMetta-lsp › Server: Spawn Processand settingMetta-lsp › Server: Portaccordingly. WithoutSTART_SERVER, the extension spawns its own server once configured. - Point the extension at this workspace either through the settings UI or via
settings.json: enablemetta-lsp › Server: Debug Lspand setMetta-lsp › Server: Mettalog Pathto~/vscode_petta_mork/upstreams/metta-wam(or wherever you cloned the repo). - Because
scripts/link_toolchains.shmirrors.local/share/swi-prolog/packinto the repo, VS Code and the devcontainer automatically see the installedlsp_serverpack; repeat the same steps inside the container if you ever rebuild the image.
Manual fallback: if you need to run the individual commands yourself, upstreams/metta-wam/libraries/lsp_server_metta/vscode contains the package sources—npm install followed by npx vsce package produces the .vsix the script wraps.
AGENTS.md: Operating guidance for CLI agents working in this repo (structure, style, testing, review expectations).README.md: You are here; overall onboarding instructions for developers.CHANGELOG.md: Human-readable history of released changes.Makefile/Taskfile.yml: Automation entry points for building the dev container, syncing upstreams, etc.config/: Containsupstreams.list, the source of truth for external repositories pulled intoupstreams/.docker/: Dockerfile and scripts used to build thepetta-devcontainer image.docker-compose.yml: Defines thepetta-devservice used bymake up(bind-mounts the repo, sets user IDs).scripts/: Helper scripts (bootstrap_repos.sh,lock_repos.sh,link_toolchains.sh,unlock_repos.sh, etc.) that automate workspace tasks.upstreams/: Auto-populated clones of external repositories (PeTTa, MORK, PathMap, etc.) managed viamake bootstrap. Each upstream maintains its own README; edit code there only when vendoring fixes.
sudo apt update
sudo apt install -y docker.io docker-compose-plugin
# If docker-compose-plugin isn't in your apt sources, install the legacy CLI:
# sudo apt install -y docker.io docker-compose
sudo systemctl enable --now docker
sudo usermod -aG docker $USER
mkdir -p ~/.docker && chmod 700 ~/.docker
newgrp docker # or sign out/in so group membership applies
docker run hello-worldmake buildmake bootstrapCreate the host/container symlinks for the Rust toolchain caches and SWI-Prolog packs so editors and the devcontainer see the same paths:
./scripts/link_toolchains.shThis script links ~/vscode_petta_mork/.cargo → ~/.cargo, ~/vscode_petta_mork/.rustup → ~/.rustup, and keeps both ~/.config/swi-prolog/pack and ~/.local/share/swi-prolog/pack mirrored into the repo so SWI pack installs show up under version control.
docker compose run --rm petta-dev bash -lc 'cd ~/vscode_petta_mork && python3 -m venv .venv'make upOpen folder: ~/vscode_petta_mork, then Reopen in Container.
make lockOnly run this when you need to pin config/upstreams.list for a release. Day-to-day contributors should skip this step so upstream repos continue tracking their configured branches. When you need to refresh the locked SHAs, run:
make updatewhich syncs upstreams (via bootstrap) and immediately re-locks them. To reset the file back to AUTO and pick up latest commits again:
make unlockThis command simply rewrites the fourth column in config/upstreams.list to AUTO.
If Docker isn't available or you prefer to run tooling directly on the host:
-
Install SWI-Prolog, Python 3, build tools, and create
.venvby running:./scripts/make_local.sh
(You may be prompted for sudo to install packages via
apt.) -
Enter a host shell with the virtualenv activated:
make local-shell
This path mirrors the container environment closely enough to run pytest, swipl, or other local tools without Docker.