From 210f7eab68214562952c77bfbe3b425d74c21470 Mon Sep 17 00:00:00 2001 From: tegwick Date: Fri, 3 Jul 2026 00:54:21 +0200 Subject: [PATCH] Add Makefile targets to install and verify phase-memory with warden. install-all uses uv tool install --with-editable for sibling phase-memory. check-memory and verify-memory confirm warden can load experiential memory. --- AGENTS.md | 4 ++-- Makefile | 49 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 27 ++++++++++++++++++++---- src/warden/memory.py | 3 ++- 4 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/AGENTS.md b/AGENTS.md index 42cd84b..f96fd05 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -180,8 +180,8 @@ Episodes are recorded automatically unless `WARDEN_MEMORY=0`. **Worker:** `warden worker run --brain llm` skips OpenRouter when stabilized routing memory matches. See `wiki/OpsWardenMemory.md`. -Requires `phase-memory` on `PYTHONPATH` or installed; contract in -`phase-memory/docs/ops-warden-memory-contract.md`. +Install bundled memory: `make install-all` then `make check-memory` from +`~/ops-warden`. Contract: `phase-memory/docs/ops-warden-memory-contract.md`. --- diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0a71247 --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +# ops-warden development and install targets +ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +PHASE_MEMORY_REPO ?= $(abspath $(ROOT)/../phase-memory) + +.DEFAULT_GOAL := help + +.PHONY: help sync install install-warden install-memory install-all check-memory verify-memory test lint + +help: + @echo "ops-warden make targets" + @echo "" + @echo " make sync # uv sync (dev dependencies)" + @echo " make install # install warden CLI (SSH only, no phase-memory)" + @echo " make install-memory # reinstall warden with editable phase-memory" + @echo " make install-all # sync + warden + phase-memory (recommended)" + @echo " make check-memory # fail unless phase-memory is importable by warden" + @echo " make verify-memory # check-memory + warden memory status" + @echo " make test # unit tests" + @echo " make lint # ruff check" + @echo "" + @echo "Override phase-memory path: make install-all PHASE_MEMORY_REPO=/path/to/phase-memory" + +sync: + uv sync + +install-warden: + uv tool install . --force + +install-memory: + @test -d "$(PHASE_MEMORY_REPO)" || (echo "ERROR: phase-memory not found at $(PHASE_MEMORY_REPO). Clone it or set PHASE_MEMORY_REPO."; exit 1) + @test -f "$(PHASE_MEMORY_REPO)/pyproject.toml" || (echo "ERROR: $(PHASE_MEMORY_REPO) is not a phase-memory checkout."; exit 1) + uv tool install . --with-editable "$(PHASE_MEMORY_REPO)" --force + +install: install-warden + +install-all: sync install-memory + +check-memory: + @warden memory status --json >/dev/null 2>&1 || (echo "ERROR: phase-memory is not available to warden. Run: make install-memory"; exit 1) + @echo "phase-memory: ok (warden memory status succeeded)" + +verify-memory: check-memory + @warden memory status + +test: + PYTHONPATH=src:$(PHASE_MEMORY_REPO)/src uv run pytest + +lint: + uv run ruff check . \ No newline at end of file diff --git a/README.md b/README.md index d14c238..a65f11e 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,24 @@ Latest gap analysis: `history/2026-06-17-post-wp0007-reassessment.md`. ## Install +**Recommended** (warden + experiential memory for route/worker/agent sessions): + +```bash +make install-all +make verify-memory +``` + +SSH-only install (no phase-memory): + +```bash +make install +``` + +Manual equivalent: + ```bash uv sync -uv tool install . +uv tool install . --with-editable ../phase-memory --force ``` Or run without installing: @@ -22,6 +37,10 @@ Or run without installing: uv run warden --help ``` +phase-memory must be a sibling checkout at `../phase-memory` by default, or set +`PHASE_MEMORY_REPO` when running make. Opt out of memory at runtime with +`WARDEN_MEMORY=0`. + ## Quick start (local backend) ```bash @@ -58,10 +77,10 @@ Full role and examples: `wiki/AccessRouting.md`. ## Development ```bash -uv sync -uv run pytest # unit tests (integration excluded) +make install-all +make test +make lint uv run pytest -m integration # requires ssh-keygen in PATH -uv run ruff check . ``` ## Key paths diff --git a/src/warden/memory.py b/src/warden/memory.py index d8e5cfc..0296e75 100644 --- a/src/warden/memory.py +++ b/src/warden/memory.py @@ -7,7 +7,8 @@ from typing import Any, Mapping, Optional _PHASE_MEMORY_ERROR = ( "phase-memory is required for warden memory commands. " - "Install with: pip install phase-memory (or set PYTHONPATH to phase-memory/src)." + "From ~/ops-warden run: make install-memory (or make install-all). " + "Dev fallback: PYTHONPATH=../phase-memory/src" ) # In-process cache: implicit activation is default; no separate `warden memory activate`