Skip to content

The agent that grows with you

fix(skills): document skills share one PM-built side environment; pause before Enter in the no-tmux recipe

Teknium4a8c01790a03
diff --git a/optional-skills/finance/excel-author/SKILL.md b/optional-skills/finance/excel-author/SKILL.md
index 095f6f3e003..e715a4c1848 100644
--- a/optional-skills/finance/excel-author/SKILL.md
+++ b/optional-skills/finance/excel-author/SKILL.md
@@ -25,18 +25,15 @@ Adapted from Anthropic's `xlsx-author` and `audit-xls` skills in the [anthropics
## Setup
-Use `python` when it already imports `openpyxl` (the Hermes Docker image
-ships it). Otherwise install into a persistent side environment under the
-Hermes home, never into the interpreter that runs Hermes:
+Use `python` when it already imports `openpyxl` (the Hermes Docker image ships
+it). Otherwise let Hermes build its shared, pinned documents environment
+under the Hermes home (the same command as the docx/xlsx/powerpoint/pdf
+skills; safe to run from several agents at once), and never `pip install`
+into the interpreter that runs Hermes:
```bash
-export PY=python
-if ! "$PY" -c "import openpyxl" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV"
- "$PY" -c "import openpyxl" 2>/dev/null || "$PY" -m pip install -q "openpyxl>=3.0"
-fi
+python -c "import openpyxl" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+export PY
```
Run the model-building Python with `"$PY"`.
diff --git a/optional-skills/finance/pptx-author/SKILL.md b/optional-skills/finance/pptx-author/SKILL.md
index acd93e9ea74..7aaff49a53a 100644
--- a/optional-skills/finance/pptx-author/SKILL.md
+++ b/optional-skills/finance/pptx-author/SKILL.md
@@ -27,17 +27,14 @@ For the broader, already-shipped PowerPoint authoring skill (slides, speaker not
## Setup
Use `python` when it already imports `pptx` (the Hermes Docker image ships
-it). Otherwise install into a persistent side environment under the Hermes
-home, never into the interpreter that runs Hermes:
+it). Otherwise let Hermes build its shared, pinned documents environment
+under the Hermes home (the same command as the docx/xlsx/powerpoint/pdf
+skills; safe to run from several agents at once), and never `pip install`
+into the interpreter that runs Hermes:
```bash
-export PY=python
-if ! "$PY" -c "import pptx" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV"
- "$PY" -c "import pptx" 2>/dev/null || "$PY" -m pip install -q "python-pptx>=0.6"
-fi
+python -c "import pptx" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+export PY
```
Run the deck-building Python with `"$PY"`.
diff --git a/pm/cli.py b/pm/cli.py
index 08829547760..94fb0907bc9 100644
--- a/pm/cli.py
+++ b/pm/cli.py
@@ -820,6 +820,72 @@ def cmd_repair(args) -> int:
return 0
+def _extra_requirements(project: Path, extras: list[str]) -> list[str]:
+ """The pinned requirements of declared extras, self-references expanded.
+
+ Pins, not the whole lock, define the environment: an identity over uv.lock
+ would build a new generation on every Hermes update, and superseded side
+ generations are never reclaimed while a caller may still run from them.
+ """
+ import re
+ import tomllib
+
+ declared = tomllib.loads((project / "pyproject.toml").read_text(encoding="utf-8"))
+ name = declared["project"]["name"]
+ table = declared["project"].get("optional-dependencies", {})
+ requirements: list[str] = []
+ pending, seen = list(extras), set()
+ while pending:
+ extra = pending.pop()
+ if extra in seen:
+ continue
+ if extra not in table:
+ raise ValueError(f"{extra!r} is not an extra declared in {project / 'pyproject.toml'}")
+ seen.add(extra)
+ for requirement in table[extra]:
+ own = re.fullmatch(rf"{re.escape(name)}\[([^\]]+)\]", requirement.replace(" ", ""))
+ if own:
+ pending.extend(own.group(1).split(","))
+ else:
+ requirements.append(requirement)
+ return requirements
+
+
+def cmd_environment(args) -> int:
+ """Make a named side environment current and print its interpreter.
+
+ Shell callers (skills) cannot import PM: the terminal's `python` is rarely
+ Hermes's own. Concurrent callers serialize on PM's per-environment lock and
+ a rebuild lands in a new generation, so a running caller keeps its files.
+ """
+ import contextlib
+ import os
+
+ import pm
+
+ if bool(args.extra) == bool(args.requirement):
+ print("hermes pm environment: pass --extra or --requirement (not both)", file=sys.stderr)
+ return 2
+ # stdout carries only the interpreter path, for PY=$(hermes pm environment ...);
+ # progress from PM and its uv children goes to stderr at both levels.
+ sys.stdout.flush()
+ saved = os.dup(1)
+ os.dup2(2, 1)
+ try:
+ with contextlib.redirect_stdout(sys.stderr):
+ requirements = _extra_requirements(repo_root(), args.extra) if args.extra else args.requirement
+ python = pm.ensure_environment(args.name, requirements, explicit=True)
+ except (InstallError, ValueError) as exc:
+ print(f"hermes pm environment: {exc}", file=sys.stderr)
+ return 1
+ finally:
+ sys.stdout.flush()
+ os.dup2(saved, 1)
+ os.close(saved)
+ print(python)
+ return 0
+
+
def cmd_bundle(args) -> int:
from scripts.bundles.native import stage_native
return stage_native(args)
@@ -881,6 +947,17 @@ def main(argv=None) -> int:
p = sub.add_parser("repair", help="rebuild the recorded dependency environment without changing its graph")
p.set_defaults(func=cmd_repair)
+ p = sub.add_parser(
+ "environment", help="make a named side environment current and print its python",
+ description="Build or reuse HERMES_HOME/environments/NAME, an isolated venv that never "
+ "touches Hermes's own: --extra installs the pins of a declared extra, "
+ "--requirement an ad hoc bounded requirement (both repeatable). "
+ "Prints only the interpreter path on stdout.")
+ p.add_argument("name")
+ p.add_argument("--extra", action="append", default=[], metavar="EXTRA")
+ p.add_argument("--requirement", action="append", default=[], metavar="REQ")
+ p.set_defaults(func=cmd_environment)
+
p = sub.add_parser("gc", help="remove store entries nothing references")
p.set_defaults(func=cmd_gc)
diff --git a/pm/extras.py b/pm/extras.py
index 9f92c9de33f..4c176c50765 100644
--- a/pm/extras.py
+++ b/pm/extras.py
@@ -60,6 +60,7 @@ ANCHORS: dict[str, str | tuple[str, ...]] = {
"web": "fastapi",
"doc-extract": "anydoc",
"documents": ("docx", "openpyxl", "pptx", "reportlab", "pypdf"),
+ "documents-pdf": ("pdfplumber", "pypdfium2"),
"computer-use": "mcp",
"trace-upload": "huggingface_hub",
# Pillow resize recovery for vision tools (the `vision` extra is a no-op
diff --git a/pyproject.toml b/pyproject.toml
index 2d20bf61a4d..ab993f3568f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -384,6 +384,13 @@ documents = [
"reportlab==5.1.0",
"pypdf==6.21.2",
]
+# PDF text extraction and rasterization for skills/productivity/pdf. Only in
+# the skills' side environment (`hermes pm environment documents --extra
+# documents --extra documents-pdf`), never baked: ~17 MB of pdfminer/pdfium.
+documents-pdf = [
+ "pdfplumber==0.11.10",
+ "pypdfium2==5.14.0",
+]
trace-upload = ["huggingface-hub==1.33.0"]
# Cloud memory providers are opt-in PM extras. They stay outside [all]
# so a quarantined release cannot break fresh installs.
diff --git a/skills/autonomous-ai-agents/hermes-agent/SKILL.md b/skills/autonomous-ai-agents/hermes-agent/SKILL.md
index 9821ac7248a..cdd44360824 100644
--- a/skills/autonomous-ai-agents/hermes-agent/SKILL.md
+++ b/skills/autonomous-ai-agents/hermes-agent/SKILL.md
@@ -160,14 +160,16 @@ terminal(command="tmux send-keys -t agent1 'Add rate limiting middleware' && sle
terminal(command="tmux send-keys -t agent1 '/exit' && sleep 0.5 && tmux send-keys -t agent1 Enter && sleep 2 && tmux kill-session -t agent1", timeout=10)
```
-**No tmux** (`command -v tmux` prints nothing, e.g. an older Hermes Docker image): run Hermes as a PTY background process and drive it with `process_manage`. Stdin only exists with `pty=true`. Send the text and the Enter key (`"\r"`) as two separate `write` calls, for the same reason as with tmux; `submit` appends `"\n"`, which Hermes reads as a newline, never as Enter.
+**No tmux** (`command -v tmux` prints nothing, e.g. an older Hermes Docker image): run Hermes as a PTY background process and drive it with `process_manage`. Stdin only exists with `pty=true`. Send the text, pause, then send the Enter key (`"\r"`) as its own `write`, for the same reason as with tmux: an Enter that arrives right after the text is read as part of a paste and becomes a newline. Use `write`, not `submit`, for the Enter.
```
terminal(command="hermes", background=true, pty=true) # returns session_id
process_manage(action="write", session_id="<id>", data="Build a FastAPI auth service")
+terminal(command="sleep 0.5")
process_manage(action="write", session_id="<id>", data="\r")
process_manage(action="log", session_id="<id>", limit=40) # read the screen
process_manage(action="write", session_id="<id>", data="/exit")
+terminal(command="sleep 0.5")
process_manage(action="write", session_id="<id>", data="\r")
```
diff --git a/skills/productivity/docx/SKILL.md b/skills/productivity/docx/SKILL.md
index 4d1d5260306..f746017252a 100644
--- a/skills/productivity/docx/SKILL.md
+++ b/skills/productivity/docx/SKILL.md
@@ -38,24 +38,22 @@ fields, and package health checks. It does not render documents itself
- Python 3.10+ with `python-docx` (import name `docx`; lxml comes with it).
- Pick the interpreter with `terminal`. Use `python` when it already imports
- the libraries (the Hermes Docker image ships them); otherwise use a
- persistent side environment under the Hermes home, which survives container
- restarts and never touches the Hermes install itself:
+ the libraries (the Hermes Docker image ships them); otherwise let Hermes
+ build its shared, pinned documents environment under the Hermes home. It
+ survives container restarts, never touches the Hermes install itself, and is
+ safe to run from several agents at once. Use this exact command in every
+ document skill so they all share one environment:
```bash
- export PY=python
- if ! "$PY" -c "import docx" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV" # new, or broken by a Python upgrade
- "$PY" -c "import docx" 2>/dev/null || "$PY" -m pip install -q python-docx
- fi
+ python -c "import docx" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+ export PY
"$PY" scripts/docx_create.py --help
```
- Run every helper below with `"$PY"`. On Windows the side interpreter is
- `%HERMES_HOME%\environments\documents\Scripts\python.exe`. Never
- `pip install` into the interpreter that runs Hermes.
+ Run every helper below with `"$PY"`. In PowerShell:
+ `$env:PY = hermes pm environment documents --extra documents --extra documents-pdf`.
+ Never `pip install` into the interpreter that runs Hermes or into this
+ environment; `hermes pm environment` owns it.
- Comments `add` uses the native API on python-docx >= 1.2 and an XML
fallback on older versions — both are automatic.
- For image blocks: the image files must exist locally (PNG/JPEG).
diff --git a/skills/productivity/pdf/SKILL.md b/skills/productivity/pdf/SKILL.md
index 3f5ba39cb9a..c8aac0dd4a7 100644
--- a/skills/productivity/pdf/SKILL.md
+++ b/skills/productivity/pdf/SKILL.md
@@ -33,25 +33,23 @@ Create PDFs from structured specs, build and fill AcroForm forms (with layout li
- Python 3.10+ with `pypdf`, `reportlab`, `pdfplumber`.
- Pick the interpreter with `terminal`. Use `python` when it already imports
- the libraries (the Hermes Docker image ships them); otherwise use a
- persistent side environment under the Hermes home, which survives container
- restarts and never touches the Hermes install itself:
+ the libraries (the Hermes Docker image ships them); otherwise let Hermes
+ build its shared, pinned documents environment under the Hermes home. It
+ survives container restarts, never touches the Hermes install itself, and is
+ safe to run from several agents at once. Use this exact command in every
+ document skill so they all share one environment:
```bash
- export PY=python
- if ! "$PY" -c "import pypdf, reportlab, pdfplumber" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV" # new, or broken by a Python upgrade
- "$PY" -c "import pypdf, reportlab, pdfplumber" 2>/dev/null || "$PY" -m pip install -q pypdf reportlab pdfplumber
- fi
+ python -c "import pypdf, reportlab, pdfplumber" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+ export PY
"$PY" scripts/pdf_create.py --help
```
- Run every helper below with `"$PY"`. On Windows the side interpreter is
- `%HERMES_HOME%\environments\documents\Scripts\python.exe`. Never
- `pip install` into the interpreter that runs Hermes.
-- Optional, for page rasterization (`pdf_page_image.py`, overlay rendering): `pypdfium2` installed into that side environment (`"$DOCS_ENV/bin/python" -m pip install pypdfium2`, then use it as `$PY`), or poppler's `pdftoppm` on PATH. Scripts fall back pypdfium2 → pdftoppm and report `{"rendered": false, "missing": [...]}` (exit 0) when neither exists.
+ Run every helper below with `"$PY"`. In PowerShell:
+ `$env:PY = hermes pm environment documents --extra documents --extra documents-pdf`.
+ Never `pip install` into the interpreter that runs Hermes or into this
+ environment; `hermes pm environment` owns it.
+- Page rasterization (`pdf_page_image.py`, overlay rendering) uses `pypdfium2`, which the documents environment already has (if your `python` lacks it, switch `PY` to that environment with the command above), or poppler's `pdftoppm` on PATH. Scripts fall back pypdfium2 → pdftoppm and report `{"rendered": false, "missing": [...]}` (exit 0) when neither exists.
- Each helper script checks imports lazily and prints an install hint if a dependency is missing.
## How to Run
diff --git a/skills/productivity/pdf/references/ocr-extraction.md b/skills/productivity/pdf/references/ocr-extraction.md
index 7705739016b..f2ea3e5315b 100644
--- a/skills/productivity/pdf/references/ocr-extraction.md
+++ b/skills/productivity/pdf/references/ocr-extraction.md
@@ -51,12 +51,12 @@ If the user needs marker capabilities but the system lacks ~5GB free disk:
## pymupdf (lightweight)
-Install into the persistent documents environment from the pdf skill's
-Prerequisites (`$DOCS_ENV`, ~110 MB with its deps; never into Hermes's own
-interpreter), then run the helper with `"$PY"`:
+Let Hermes build a separate side environment for it (~110 MB with
+its deps; never `pip install` into Hermes's own interpreter), then run the
+helper and the inline snippet below with `"$PY"` instead of `python`:
```bash
-"$DOCS_ENV/bin/python" -m pip install -q pymupdf pymupdf4llm && PY="$DOCS_ENV/bin/python"
+PY="$(hermes pm environment pdf-pymupdf --requirement 'pymupdf>=1.26,<3' --requirement 'pymupdf4llm>=0.2,<3')"
```
**Via helper script**:
@@ -87,7 +87,8 @@ for page in doc:
# Check disk space first
python scripts/extract_marker.py --check
-"$DOCS_ENV/bin/python" -m pip install marker-pdf # same side environment as pymupdf
+# its own side environment (PyTorch + models); run the helper with "$PY"
+PY="$(hermes pm environment pdf-marker --requirement 'marker-pdf>=1.8,<3')"
```
**Via helper script**:
diff --git a/skills/productivity/pdf/scripts/_raster.py b/skills/productivity/pdf/scripts/_raster.py
index 9ed7b5e9ba4..71efd627ee9 100644
--- a/skills/productivity/pdf/scripts/_raster.py
+++ b/skills/productivity/pdf/scripts/_raster.py
@@ -26,7 +26,7 @@ def available_backends() -> list[str]:
def missing_hints() -> list[str]:
"""Install hints for when no backend is available."""
return [
- "pypdfium2 in the persistent documents environment (pdf skill, Prerequisites)",
+ "pypdfium2: hermes pm environment documents --extra documents --extra documents-pdf",
"poppler-utils (provides pdftoppm), e.g. apt-get install poppler-utils",
]
diff --git a/skills/productivity/pdf/scripts/pdf_create.py b/skills/productivity/pdf/scripts/pdf_create.py
index 3f68951f483..8b5f756ba0c 100644
--- a/skills/productivity/pdf/scripts/pdf_create.py
+++ b/skills/productivity/pdf/scripts/pdf_create.py
@@ -47,7 +47,7 @@ def build_pdf(spec: dict, out_path: str) -> int:
TableStyle,
)
except ImportError:
- print("Missing dependency: 'reportlab' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print("Missing dependency: 'reportlab' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
return 2
page_size = letter if str(spec.get("page_size", "A4")).lower() == "letter" else A4
diff --git a/skills/productivity/pdf/scripts/pdf_fill_form.py b/skills/productivity/pdf/scripts/pdf_fill_form.py
index d039972e61c..112499a9688 100644
--- a/skills/productivity/pdf/scripts/pdf_fill_form.py
+++ b/skills/productivity/pdf/scripts/pdf_fill_form.py
@@ -35,7 +35,7 @@ def main() -> int:
from pypdf import PdfReader, PdfWriter
from pypdf.generic import BooleanObject, NameObject
except ImportError:
- print("Missing dependency: 'pypdf' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print("Missing dependency: 'pypdf' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
return 2
with open(args.fields_json, encoding="utf-8") as fh:
diff --git a/skills/productivity/pdf/scripts/pdf_make_form.py b/skills/productivity/pdf/scripts/pdf_make_form.py
index 7cf0aa3b4d7..1f2fe58e2d0 100644
--- a/skills/productivity/pdf/scripts/pdf_make_form.py
+++ b/skills/productivity/pdf/scripts/pdf_make_form.py
@@ -54,7 +54,7 @@ def build_form(spec: dict, out_path: str) -> int:
from reportlab.lib import colors
from reportlab.pdfgen import canvas
except ImportError:
- print("Missing dependency: 'reportlab' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print("Missing dependency: 'reportlab' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
return 2
width, height = _page_size(spec)
diff --git a/skills/productivity/pdf/scripts/pdf_merge.py b/skills/productivity/pdf/scripts/pdf_merge.py
index ce330f7bab1..3ea583960c2 100644
--- a/skills/productivity/pdf/scripts/pdf_merge.py
+++ b/skills/productivity/pdf/scripts/pdf_merge.py
@@ -24,7 +24,7 @@ def main() -> int:
try:
from pypdf import PdfReader, PdfWriter
except ImportError:
- print("Missing dependency: 'pypdf' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print("Missing dependency: 'pypdf' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
return 2
writer = PdfWriter()
diff --git a/skills/productivity/pdf/scripts/pdf_meta.py b/skills/productivity/pdf/scripts/pdf_meta.py
index 90031fd8601..a016f2c8594 100644
--- a/skills/productivity/pdf/scripts/pdf_meta.py
+++ b/skills/productivity/pdf/scripts/pdf_meta.py
@@ -46,7 +46,7 @@ def main() -> int:
try:
from pypdf import PdfReader, PdfWriter
except ImportError:
- print("Missing dependency: 'pypdf' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print("Missing dependency: 'pypdf' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
return 2
reader = PdfReader(args.pdf)
diff --git a/skills/productivity/pdf/scripts/pdf_page_image.py b/skills/productivity/pdf/scripts/pdf_page_image.py
index a32d6f20bdb..d813b33483b 100644
--- a/skills/productivity/pdf/scripts/pdf_page_image.py
+++ b/skills/productivity/pdf/scripts/pdf_page_image.py
@@ -62,7 +62,7 @@ def main() -> int:
try:
from pypdf import PdfReader
except ImportError:
- print("Missing dependency: 'pypdf' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print("Missing dependency: 'pypdf' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
return 2
reader = PdfReader(args.pdf)
if reader.is_encrypted:
diff --git a/skills/productivity/pdf/scripts/pdf_read.py b/skills/productivity/pdf/scripts/pdf_read.py
index b871bc6e487..6dd51c2d6a2 100644
--- a/skills/productivity/pdf/scripts/pdf_read.py
+++ b/skills/productivity/pdf/scripts/pdf_read.py
@@ -21,7 +21,7 @@ def _need(module: str, package: str):
try:
return __import__(module)
except ImportError:
- print(f"Missing dependency: '{package}' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print(f"Missing dependency: '{package}' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
raise SystemExit(2)
diff --git a/skills/productivity/pdf/scripts/pdf_secure.py b/skills/productivity/pdf/scripts/pdf_secure.py
index 0cb1213f445..283183f2348 100644
--- a/skills/productivity/pdf/scripts/pdf_secure.py
+++ b/skills/productivity/pdf/scripts/pdf_secure.py
@@ -31,7 +31,7 @@ def main() -> int:
try:
from pypdf import PdfReader, PdfWriter
except ImportError:
- print("Missing dependency: 'pypdf' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print("Missing dependency: 'pypdf' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
return 2
reader = PdfReader(args.pdf)
diff --git a/skills/productivity/pdf/scripts/pdf_split.py b/skills/productivity/pdf/scripts/pdf_split.py
index d586a6c16a0..c6be074687f 100644
--- a/skills/productivity/pdf/scripts/pdf_split.py
+++ b/skills/productivity/pdf/scripts/pdf_split.py
@@ -51,7 +51,7 @@ def main() -> int:
try:
from pypdf import PdfReader, PdfWriter
except ImportError:
- print("Missing dependency: 'pypdf' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print("Missing dependency: 'pypdf' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
return 2
reader = PdfReader(args.pdf)
diff --git a/skills/productivity/pdf/scripts/pdf_stamp.py b/skills/productivity/pdf/scripts/pdf_stamp.py
index 829a927f3a5..9494ff9a409 100644
--- a/skills/productivity/pdf/scripts/pdf_stamp.py
+++ b/skills/productivity/pdf/scripts/pdf_stamp.py
@@ -103,7 +103,7 @@ def main() -> int:
try:
from pypdf import PdfReader, PdfWriter
except ImportError:
- print("Missing dependency: 'pypdf reportlab' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter",
+ print("Missing dependency: 'pypdf reportlab' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf",
file=sys.stderr)
return 2
diff --git a/skills/productivity/pdf/scripts/pdf_watermark.py b/skills/productivity/pdf/scripts/pdf_watermark.py
index 7e00f939530..372cce2b6c1 100644
--- a/skills/productivity/pdf/scripts/pdf_watermark.py
+++ b/skills/productivity/pdf/scripts/pdf_watermark.py
@@ -26,7 +26,7 @@ def main() -> int:
try:
from pypdf import PdfReader, PdfWriter
except ImportError:
- print("Missing dependency: 'pypdf' is not importable here; install it into the persistent documents environment (pdf skill, Prerequisites) and rerun with that interpreter", file=sys.stderr)
+ print("Missing dependency: 'pypdf' is not importable here; rerun with the documents environment's interpreter: hermes pm environment documents --extra documents --extra documents-pdf", file=sys.stderr)
return 2
reader = PdfReader(args.pdf)
diff --git a/skills/productivity/powerpoint/SKILL.md b/skills/productivity/powerpoint/SKILL.md
index f69f0ed8684..bfaa67751b0 100644
--- a/skills/productivity/powerpoint/SKILL.md
+++ b/skills/productivity/powerpoint/SKILL.md
@@ -35,24 +35,22 @@ and slide rendering — all offline, no PowerPoint installation required.
- Python 3.10+ with `python-pptx` (import name `pptx`).
- Pick the interpreter with `terminal`. Use `python` when it already imports
- the libraries (the Hermes Docker image ships them); otherwise use a
- persistent side environment under the Hermes home, which survives container
- restarts and never touches the Hermes install itself:
+ the libraries (the Hermes Docker image ships them); otherwise let Hermes
+ build its shared, pinned documents environment under the Hermes home. It
+ survives container restarts, never touches the Hermes install itself, and is
+ safe to run from several agents at once. Use this exact command in every
+ document skill so they all share one environment:
```bash
- export PY=python
- if ! "$PY" -c "import pptx" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV" # new, or broken by a Python upgrade
- "$PY" -c "import pptx" 2>/dev/null || "$PY" -m pip install -q python-pptx
- fi
+ python -c "import pptx" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+ export PY
"$PY" scripts/pptx_create.py --help
```
- Run every helper below with `"$PY"`. On Windows the side interpreter is
- `%HERMES_HOME%\environments\documents\Scripts\python.exe`. Never
- `pip install` into the interpreter that runs Hermes.
+ Run every helper below with `"$PY"`. In PowerShell:
+ `$env:PY = hermes pm environment documents --extra documents --extra documents-pdf`.
+ Never `pip install` into the interpreter that runs Hermes or into this
+ environment; `hermes pm environment` owns it.
- Optional: LibreOffice (`soffice`) plus poppler (`pdftoppm` or
`pdftocairo`) for rendering slides to PNGs and for PDF export.
`pptx_render.py` detects both with `shutil.which` and degrades
diff --git a/skills/productivity/xlsx/SKILL.md b/skills/productivity/xlsx/SKILL.md
index 7e272fe0347..b93878adc60 100644
--- a/skills/productivity/xlsx/SKILL.md
+++ b/skills/productivity/xlsx/SKILL.md
@@ -41,24 +41,22 @@ scripts are argparse CLIs that print JSON and use explicit UTF-8 I/O.
- Python 3.10+ with `openpyxl`. No other third-party packages are
needed; everything else is stdlib.
- Pick the interpreter with `terminal`. Use `python` when it already imports
- the libraries (the Hermes Docker image ships them); otherwise use a
- persistent side environment under the Hermes home, which survives container
- restarts and never touches the Hermes install itself:
+ the libraries (the Hermes Docker image ships them); otherwise let Hermes
+ build its shared, pinned documents environment under the Hermes home. It
+ survives container restarts, never touches the Hermes install itself, and is
+ safe to run from several agents at once. Use this exact command in every
+ document skill so they all share one environment:
```bash
- export PY=python
- if ! "$PY" -c "import openpyxl" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV" # new, or broken by a Python upgrade
- "$PY" -c "import openpyxl" 2>/dev/null || "$PY" -m pip install -q openpyxl
- fi
+ python -c "import openpyxl" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+ export PY
"$PY" scripts/xlsx_create.py --help
```
- Run every helper below with `"$PY"`. On Windows the side interpreter is
- `%HERMES_HOME%\environments\documents\Scripts\python.exe`. Never
- `pip install` into the interpreter that runs Hermes.
+ Run every helper below with `"$PY"`. In PowerShell:
+ `$env:PY = hermes pm environment documents --extra documents --extra documents-pdf`.
+ Never `pip install` into the interpreter that runs Hermes or into this
+ environment; `hermes pm environment` owns it.
- Optional: LibreOffice (`soffice`) for headless recalculation or
format conversion.
diff --git a/tests/pm/test_environment_command.py b/tests/pm/test_environment_command.py
new file mode 100644
index 00000000000..640ec01897e
--- /dev/null
+++ b/tests/pm/test_environment_command.py
@@ -0,0 +1,95 @@
+"""`hermes pm environment`: the shell entry skills use for a named side environment."""
+
+from __future__ import annotations
+
+import os
+from pathlib import Path
+
+import pytest
+
+import pm
+from pm import cli, runtime
+
+PROJECT = Path(cli.__file__).resolve().parents[1]
+
+
[email protected](autouse=True)
+def _in_pm_runtime(monkeypatch):
+ # The command body as it runs once `hermes pm` is inside PM's runtime;
+ # repo_root() would consult the worktree manifest under the real home.
+ monkeypatch.setattr(runtime, "is_runtime", lambda: True)
+ monkeypatch.setattr(cli, "repo_root", lambda: PROJECT)
+
+
+def _noisy(result: Path, calls: list):
+ def ensure(*args, **kwargs):
+ calls.append((args, kwargs))
+ # Progress from PM (and its uv children) is written to fd 1 directly.
+ os.write(1, b" -> Installing Python dependencies\n")
+ print(" ok Installing Python dependencies")
+ return result
+ return ensure
+
+
+def test_stdout_is_only_the_interpreter_for_command_substitution(monkeypatch, capfd, tmp_path):
+ calls: list = []
+ python = tmp_path / "gen-x" / "venv" / "bin" / "python"
+ monkeypatch.setattr(pm, "ensure_environment", _noisy(python, calls))
+
+ assert cli.main(["environment", "documents", "--extra", "documents", "--extra", "documents-pdf"]) == 0
+
+ out, err = capfd.readouterr()
+ assert out == f"{python}\n"
+ assert "Installing Python dependencies" in err
+ (name, requirements), kwargs = calls[0]
+ assert name == "documents"
+ # An agent asking for it is an explicit install, even where lazy installs are off.
+ assert kwargs == {"explicit": True}
+ # Both extras' pins: every skill passing the same flags shares one generation.
+ pinned = {requirement.split("==")[0] for requirement in requirements}
+ assert {"python-docx", "openpyxl", "python-pptx", "reportlab", "pypdf", "pdfplumber", "pypdfium2"} <= pinned
+ assert all("==" in requirement for requirement in requirements)
+
+
+def test_extra_expands_self_references_and_rejects_unknown(tmp_path):
+ (tmp_path / "pyproject.toml").write_text(
+ '[project]\nname = "demo"\nversion = "0"\n'
+ '[project.optional-dependencies]\n'
+ 'a = ["pkg-a==1.0"]\nb = ["demo[a]", "pkg-b==2.0"]\n', encoding="utf-8")
+
+ assert sorted(cli._extra_requirements(tmp_path, ["b"])) == ["pkg-a==1.0", "pkg-b==2.0"]
+ with pytest.raises(ValueError, match="not an extra"):
+ cli._extra_requirements(tmp_path, ["missing"])
+
+
+def test_requirements_select_an_ad_hoc_environment(monkeypatch, capfd, tmp_path):
+ calls: list = []
+ python = tmp_path / "python"
+ monkeypatch.setattr(pm, "ensure_environment", _noisy(python, calls))
+
+ assert cli.main(["environment", "pdf-pymupdf", "--requirement", "pymupdf>=1.26,<3"]) == 0
+
+ assert capfd.readouterr().out == f"{python}\n"
+ assert calls == [(("pdf-pymupdf", ["pymupdf>=1.26,<3"]), {"explicit": True})]
+
+
[email protected]("flags", [[], ["--extra", "documents", "--requirement", "pypdf>=6,<7"]])
+def test_exactly_one_source_of_requirements(monkeypatch, capfd, flags):
+ def refuse(*_args, **_kwargs):
+ raise AssertionError("must not build")
+ monkeypatch.setattr(pm, "ensure_environment", refuse)
+
+ assert cli.main(["environment", "documents", *flags]) == 2
+ assert capfd.readouterr().out == ""
+
+
+def test_a_failed_build_reports_on_stderr_and_restores_stdout(monkeypatch, capfd):
+ def fail(*_args, **_kwargs):
+ raise pm.InstallError("documents", "no network")
+ monkeypatch.setattr(pm, "ensure_environment", fail)
+
+ assert cli.main(["environment", "documents", "--extra", "documents"]) == 1
+ print("after")
+ out, err = capfd.readouterr()
+ assert out == "after\n"
+ assert "no network" in err
diff --git a/uv.lock b/uv.lock
index 89768e4a0c1..6d341455e16 100644
--- a/uv.lock
+++ b/uv.lock
@@ -2410,6 +2410,10 @@ documents = [
{ name = "python-pptx" },
{ name = "reportlab" },
]
+documents-pdf = [
+ { name = "pdfplumber" },
+ { name = "pypdfium2" },
+]
edge-tts = [
{ name = "edge-tts" },
]
@@ -2695,6 +2699,7 @@ requires-dist = [
{ name = "packaging", marker = "python_full_version >= '3.14'", specifier = "==26.3" },
{ name = "parallel-web", marker = "extra == 'parallel-web'", specifier = "==0.6.0" },
{ name = "pathspec", marker = "python_full_version >= '3.14'", specifier = "==1.1.1" },
+ { name = "pdfplumber", marker = "extra == 'documents-pdf'", specifier = "==0.11.10" },
{ name = "pilk", marker = "extra == 'silk'", specifier = "==0.2.4" },
{ name = "pillow", marker = "python_full_version >= '3.14'", specifier = "==13.0.0" },
{ name = "pillow-heif", marker = "python_full_version >= '3.14'", specifier = ">=1.4.0,<2" },
@@ -2712,6 +2717,7 @@ requires-dist = [
{ name = "pyopen-wakeword", marker = "(platform_machine != 'ARM64' and platform_machine != 'x86_64' and extra == 'wake') or (platform_machine == 'ARM64' and sys_platform == 'darwin' and extra == 'wake') or (platform_machine == 'x86_64' and sys_platform == 'win32' and extra == 'wake') or (sys_platform != 'darwin' and sys_platform != 'win32' and extra == 'wake')", specifier = "==1.1.0" },
{ name = "pyopen-wakeword", marker = "(platform_machine != 'ARM64' and platform_machine != 'x86_64' and extra == 'wake-openwakeword') or (platform_machine == 'ARM64' and sys_platform == 'darwin' and extra == 'wake-openwakeword') or (platform_machine == 'x86_64' and sys_platform == 'win32' and extra == 'wake-openwakeword') or (sys_platform != 'darwin' and sys_platform != 'win32' and extra == 'wake-openwakeword')", specifier = "==1.1.0" },
{ name = "pypdf", marker = "extra == 'documents'", specifier = "==6.21.2" },
+ { name = "pypdfium2", marker = "extra == 'documents-pdf'", specifier = "==5.14.0" },
{ name = "pypinyin", marker = "extra == 'wake'", specifier = "==0.55.0" },
{ name = "pypinyin", marker = "extra == 'wake-sherpa'", specifier = "==0.55.0" },
{ name = "python-docx", marker = "extra == 'documents'", specifier = "==1.2.0" },
@@ -2769,7 +2775,7 @@ requires-dist = [
{ name = "winrt-windows-services-store", marker = "python_full_version >= '3.14' and sys_platform == 'win32'", specifier = ">=3.2.1,<4" },
{ name = "youtube-transcript-api", marker = "extra == 'youtube'", specifier = "==1.2.4" },
]
-provides-extras = ["uvloop", "anthropic", "exa", "firecrawl", "parallel-web", "ddgs", "fal", "edge-tts", "neutts", "kittentts", "piper", "modal", "daytona", "vercel", "google-meet", "messaging", "cron", "slack", "matrix", "wecom", "keychain", "tts-premium", "voice", "wake", "telegram", "discord", "stt-whisper", "audio-io", "silk", "wake-openwakeword", "wake-sherpa", "wake-porcupine", "google-chat", "doc-extract", "documents", "trace-upload", "vision", "pty", "mcp", "nemo-relay", "sms", "teams", "computer-use", "acp", "mistral", "otlp", "bedrock", "vertex", "azure-identity", "termux", "termux-all", "dingtalk", "feishu", "google", "youtube", "web", "all"]
+provides-extras = ["uvloop", "anthropic", "exa", "firecrawl", "parallel-web", "ddgs", "fal", "edge-tts", "neutts", "kittentts", "piper", "modal", "daytona", "vercel", "google-meet", "messaging", "cron", "slack", "matrix", "wecom", "keychain", "tts-premium", "voice", "wake", "telegram", "discord", "stt-whisper", "audio-io", "silk", "wake-openwakeword", "wake-sherpa", "wake-porcupine", "google-chat", "doc-extract", "documents", "documents-pdf", "trace-upload", "vision", "pty", "mcp", "nemo-relay", "sms", "teams", "computer-use", "acp", "mistral", "otlp", "bedrock", "vertex", "azure-identity", "termux", "termux-all", "dingtalk", "feishu", "google", "youtube", "web", "all"]
[package.metadata.requires-dev]
dev = [
@@ -4559,6 +4565,33 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/9a/70/875f4a23bfc4731703a5835487d0d2fb999031bd415e7d17c0ae615c18b7/pathvalidate-3.3.1-py3-none-any.whl", hash = "sha256:5263baab691f8e1af96092fa5137ee17df5bdfbd6cff1fcac4d6ef4bc2e1735f", size = 24305, upload-time = "2025-06-15T09:07:19.117Z" },
]
+[[package]]
+name = "pdfminer-six"
+version = "20260107"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "charset-normalizer" },
+ { name = "cryptography" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/34/a4/5cec1112009f0439a5ca6afa8ace321f0ab2f48da3255b7a1c8953014670/pdfminer_six-20260107.tar.gz", hash = "sha256:96bfd431e3577a55a0efd25676968ca4ce8fd5b53f14565f85716ff363889602", size = 8512094, upload-time = "2026-01-07T13:29:12.937Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/20/8b/28c4eaec9d6b036a52cb44720408f26b1a143ca9bce76cc19e8f5de00ab4/pdfminer_six-20260107-py3-none-any.whl", hash = "sha256:366585ba97e80dffa8f00cebe303d2f381884d8637af4ce422f1df3ef38111a9", size = 6592252, upload-time = "2026-01-07T13:29:10.742Z" },
+]
+
+[[package]]
+name = "pdfplumber"
+version = "0.11.10"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "pdfminer-six" },
+ { name = "pillow" },
+ { name = "pypdfium2" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/05/56/6f450312ba05a27d7713b73857c1a25100dbda04fbc1331b13fb227a607d/pdfplumber-0.11.10.tar.gz", hash = "sha256:b95b2d28c66efb0a794a83b88c6c6aea5987532a445d20a1cbcfa657022e6e57", size = 102892, upload-time = "2026-06-15T03:31:31.035Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/a2/9a/07d658e1e7fad860f1c541ab941348125dbdab773be3a0afaf32361866c7/pdfplumber-0.11.10-py3-none-any.whl", hash = "sha256:7741ea81bf165b474b153e6789d10d18e06b6ddcf3ec84289c3ef2fed6802580", size = 60047, upload-time = "2026-06-15T03:31:29.702Z" },
+]
+
[[package]]
name = "phonemizer-fork"
version = "3.3.2"
@@ -5366,6 +5399,36 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/1b/4d/c9d2d67f204eff463237a1a8f5e25a6923b7b1043982b91fcaf104c8ef60/pypdf-6.21.2-py3-none-any.whl", hash = "sha256:1d44d1a3a200f25062adff0085b02040e4646431ac2ccac22e42679e91466084", size = 407766, upload-time = "2026-10-21T16:44:53.626Z" },
]
+[[package]]
+name = "pypdfium2"
+version = "5.14.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/95/d0/c81d3a7c2a9af37b817ace1de0acd40cf44d15f12407c5e86b3668364a5c/pypdfium2-5.14.0.tar.gz", hash = "sha256:c5f009b3157f10e97dceb55963f5910eff92feb00587ba10a76f12b87ce1a4b6", size = 376498, upload-time = "2026-10-04T15:19:19.835Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/91/03/79e89eac9d811e83d606342e129f5f39e168442ddf23b024fea4a7ee4762/pypdfium2-5.14.0-py3-none-android_23_arm64_v8a.whl", hash = "sha256:bed597b2cea3990164e43f9003f71db18959d0abd5d73adc9c176e7be2d84b98", size = 3453370, upload-time = "2026-10-04T15:18:40.79Z" },
+ { url = "https://files.pythonhosted.org/packages/cc/68/369b80e408017b18eaecaa3c730bded07d90bfb65562215df200b56fb8e2/pypdfium2-5.14.0-py3-none-android_23_armeabi_v7a.whl", hash = "sha256:1951f0aed469150b13c62eabd501a9839e608ab9983ca8579be9eb73213b72b6", size = 2889924, upload-time = "2026-10-04T15:18:42.825Z" },
+ { url = "https://files.pythonhosted.org/packages/d1/ea/14673bc9d8b7beeaa1eb46e9951b22543edaf2a4676c586e3b1e032ff6ee/pypdfium2-5.14.0-py3-none-macosx_13_0_arm64.whl", hash = "sha256:2de384df66ba55fcaab0775f30f28ec1090af3dfa60276a07821efc96d993118", size = 3542294, upload-time = "2026-10-04T15:18:44.345Z" },
+ { url = "https://files.pythonhosted.org/packages/a6/11/b720097b01fa0874854f2f6669cbea4e4ea4e075769687714fac64d68964/pypdfium2-5.14.0-py3-none-macosx_13_0_x86_64.whl", hash = "sha256:e4e203ea9710fd00e5448edb6f1615dc8587035357f75f40b432dde0c33e8da1", size = 3735845, upload-time = "2026-10-04T15:18:45.975Z" },
+ { url = "https://files.pythonhosted.org/packages/92/b4/0c31aa51887cd6cd032191dfe010a6d01ed43cf03204cfbd2184ebe4b715/pypdfium2-5.14.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1b696e6901e16f114a2ec6332e5e3f8f5033a901614ead28499ab18ca6024f5", size = 3719672, upload-time = "2026-10-04T15:18:47.455Z" },
+ { url = "https://files.pythonhosted.org/packages/93/a8/ae6ef96bf66559328d07b9e402ea704352ea00c49b6a73573da57e1fb378/pypdfium2-5.14.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:593f2c952ae3ffdca0efcbb3d9464fbccb876254386114ff900cabef21157c3f", size = 3435593, upload-time = "2026-10-04T15:18:49.131Z" },
+ { url = "https://files.pythonhosted.org/packages/59/ff/a78405fab4c8bad0ec25b49c5efba2c85ed14609ec73645f95220560bd81/pypdfium2-5.14.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d436ee9e024f981e68f5775f5a9d115f93ea14ee6c2c6efd35dd17d83edf4942", size = 3868604, upload-time = "2026-10-04T15:18:51.304Z" },
+ { url = "https://files.pythonhosted.org/packages/5d/6e/09e9b62ab66c9acef5ad14f8a8c0d7b4d8d6ea6492e4e65b612ef146d373/pypdfium2-5.14.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f6f13bbcc5f4adabc2676e52f662c6cb375de86b314790b0ae08f3ab62eb116a", size = 4279333, upload-time = "2026-10-04T15:18:52.948Z" },
+ { url = "https://files.pythonhosted.org/packages/4f/a3/c9cc797fc8bdfb8f37b9b0f8b9d02a5fc196b2015f408d53624cab5b0519/pypdfium2-5.14.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:11f281613fa22313d9c7ab89947665e84eccf8ebe40e1198a84a88352305648d", size = 3799581, upload-time = "2026-10-04T15:18:54.913Z" },
+ { url = "https://files.pythonhosted.org/packages/b9/76/54355a4bbd88bdd5ed3f4405bdc345eb593df9995daf90d285cbdf5c1410/pypdfium2-5.14.0-py3-none-manylinux_2_27_s390x.manylinux_2_28_s390x.whl", hash = "sha256:51d9e9b64ebc34effaf57f9b6d4511b3f66ad3744bd1690d2cc6700853173dcf", size = 4113022, upload-time = "2026-10-04T15:18:56.774Z" },
+ { url = "https://files.pythonhosted.org/packages/7d/bc/ea461961ed0e0c4866df7a5610e76f769ef468bff28cd007e2aeecc8b882/pypdfium2-5.14.0-py3-none-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:605ab9d0d4c5e223599c9065b88d16b2c1f131c807c80dea8adbb16f1433e95b", size = 4062832, upload-time = "2026-10-04T15:18:58.471Z" },
+ { url = "https://files.pythonhosted.org/packages/32/30/dde99bc8cb3f8ace1d856095c2b4a29c80eecf9089b186a3b0845d0abc69/pypdfium2-5.14.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:382de7fe20d32c42993a274d7b6c555a5623a97570dfc1d2f5e0a16fe0d5d482", size = 5058436, upload-time = "2026-10-04T15:18:59.993Z" },
+ { url = "https://files.pythonhosted.org/packages/ec/16/5314182dda2695fdf5bd414a450ee866087068cca4725703932770d4be04/pypdfium2-5.14.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:dbfd6deff68cc46b134acd6be380d98d694a9f018fbb622c07229225c85db389", size = 4595505, upload-time = "2026-10-04T15:19:01.835Z" },
+ { url = "https://files.pythonhosted.org/packages/63/3f/474c42e726f0020095c7d5f3fb88cfd4e5d39c1361105a72899ada0ecd1b/pypdfium2-5.14.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9f4d77db5232826dd03a63481f32164331b96c21fd68f0667b2e43dbae141a93", size = 5309775, upload-time = "2026-10-04T15:19:03.564Z" },
+ { url = "https://files.pythonhosted.org/packages/6b/0c/723a6cf11cff00f125310d8c2c08362dc6c100d05fff8f92285a4df1bd41/pypdfium2-5.14.0-py3-none-musllinux_1_2_ppc64le.whl", hash = "sha256:b40a0913196a1483f0fdc22a53f8719c3aef87f1c4d8d9c38d2ad4e207500fdf", size = 5224565, upload-time = "2026-10-04T15:19:05.264Z" },
+ { url = "https://files.pythonhosted.org/packages/5c/c5/86ab02a41e77a7aa962af6545a406815aeb9abaecd9f25dec34dbc336b72/pypdfium2-5.14.0-py3-none-musllinux_1_2_riscv64.whl", hash = "sha256:790e2cac1641a65912b73bd7243f45195d36f1663c85a3e1a126a8f5867c82a3", size = 4704416, upload-time = "2026-10-04T15:19:07.05Z" },
+ { url = "https://files.pythonhosted.org/packages/ac/de/fb75013f924c5a4dde4a4a41ec13e7495f9b80022bf35dd51baa54e05910/pypdfium2-5.14.0-py3-none-musllinux_1_2_s390x.whl", hash = "sha256:09b99c8f0cb427eb17fec13c0862ed598bba34b4843df153f70fff806a2820bc", size = 5163621, upload-time = "2026-10-04T15:19:09.021Z" },
+ { url = "https://files.pythonhosted.org/packages/cd/77/e59c814f10b533bc4565abe90ccef888ba29be45ada4627ebbf710961f0d/pypdfium2-5.14.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e70d87cb0577eab38f2106f9c9606b458930beef612a1b5f298772ed259f5ec0", size = 5121606, upload-time = "2026-10-04T15:19:10.609Z" },
+ { url = "https://files.pythonhosted.org/packages/21/25/e067396b4bdd26c19f0997bfa3422d3975a49ceec2c59668e7599f2adcba/pypdfium2-5.14.0-py3-none-pyemscripten_2026_0_wasm32.whl", hash = "sha256:c73be14076bedebd9bcaf9b062579c95c668580043bccd29eb0db502101d5716", size = 2675501, upload-time = "2026-10-04T15:19:12.588Z" },
+ { url = "https://files.pythonhosted.org/packages/7f/0c/6c21f68a57d0c4c506b9e5f72506ba91d8dde47eef699f3fd9561f7bff0e/pypdfium2-5.14.0-py3-none-win32.whl", hash = "sha256:9fd5cc94a389d50298e4d8cb79af6b9b8e0d785606e2a937725dc6e271c9c6e6", size = 3805374, upload-time = "2026-10-04T15:19:14.357Z" },
+ { url = "https://files.pythonhosted.org/packages/00/dc/ca7874924c9cfd701ad53f89529968523790e70473e0b71e834668316148/pypdfium2-5.14.0-py3-none-win_amd64.whl", hash = "sha256:149fd5c6397b8df8bf7911a93506eff0be874f877afe7ac936cf5d37d21a6a06", size = 3947280, upload-time = "2026-10-04T15:19:16.302Z" },
+ { url = "https://files.pythonhosted.org/packages/46/ab/35f2276deeeebb781925e2647dd88a39f8ea1a910104a0dbb28218473502/pypdfium2-5.14.0-py3-none-win_arm64.whl", hash = "sha256:eb8aeca157808f323e39ea298cc6d6c8e080c192ea2efb1ca81daa0f0ff4d095", size = 3745021, upload-time = "2026-10-04T15:19:18.276Z" },
+]
+
[[package]]
name = "pypinyin"
version = "0.55.0"
diff --git a/website/docs/reference/package-management.md b/website/docs/reference/package-management.md
index 0d8585cb1a0..ea477f61952 100644
--- a/website/docs/reference/package-management.md
+++ b/website/docs/reference/package-management.md
@@ -499,6 +499,7 @@ Use the public `pm` module for Python dependency work:
| `pm.build_environment(source=..., out=..., explicit=True)` | Build and validate a fresh caller-owned output. No plugin discovery or application selection. |
| `pm.lock_project(source, explicit=True)` | Refresh an explicit project's lock without selecting an environment. |
| `pm.ensure_environment(name, requirements, explicit=True)` | Prepare and select an isolated dependency generation. Return its Python path. |
+| `pm.ensure_project_environment(name, project, extras=..., explicit=True)` | Prepare and select an isolated generation of a project's locked dependencies, without installing the project. Return its Python path. |
| `pm.ensure_python_tool(name, requirements, executable, explicit=True)` | Prepare an isolated tool and return its executable path. |
| `pm.environment_python(name)` / `pm.python_tool(name, executable)` | Read selected paths without installing anything. |
| `pm.venv_is_current()` | Ask a ready PM worker whether application dependencies are current. Return false if the manager runtime is unavailable. |
@@ -541,6 +542,7 @@ hermes pm install chromium
| `pm env [names...]` | Print installed packages' PM-contributed environment values as JSON. It does not install missing packages, though a cold Hermes launch may prepare its own Python runtime first. |
| `pm doctor` | Check installed tool identities, files, and digests against the lock. |
| `pm repair` | Rebuild the recorded Python dependency set in a new generation, validate it, then select it. Does not update pins, features, or plugin configuration. |
+| `pm environment NAME --extra EXTRA` / `--requirement REQ` | Make the isolated side environment `HERMES_HOME/environments/NAME` current and print only its Python path on stdout (progress goes to stderr), for shell callers such as skills: `PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"`. `--extra` installs the pinned requirements of extras declared in `pyproject.toml`; `--requirement` takes bounded ad hoc requirements. The environment records its own lock, and only a changed requirement set or Python pin builds a new generation. Concurrent calls serialize on the environment's lock, and a rebuild lands in a new generation, so a caller already using the previous one keeps its files. An explicit install: it runs even where lazy installs are off. Never `pip install` into the result. |
| `pm status` | Print the latest sync/update receipt as JSON, or report that no receipt exists. |
| `pm gc` | Remove unreferenced tool-store entries, eligible download partials, unused lease-managed Python generations, and the `installs/INSTALL_KEY/` state of deleted checkouts (a worktree removed from a `.worktrees/` dir that still exists, or a clone under the data root; a missing checkout anywhere else, such as a host install viewed from a container sharing the data root, is kept until its state has gone unused, with no sync and no launch, for `worktrees.install_state_retention_days` (default 14, 0 = forever); state whose install lock or generation lease is still held is always kept). The worktree pruner that runs at startup reclaims those orphaned state dirs too. |
diff --git a/website/docs/user-guide/skills/bundled/autonomous-ai-agents/autonomous-ai-agents-hermes-agent.md b/website/docs/user-guide/skills/bundled/autonomous-ai-agents/autonomous-ai-agents-hermes-agent.md
index c9ed3dd4f6c..ab682a36a79 100644
--- a/website/docs/user-guide/skills/bundled/autonomous-ai-agents/autonomous-ai-agents-hermes-agent.md
+++ b/website/docs/user-guide/skills/bundled/autonomous-ai-agents/autonomous-ai-agents-hermes-agent.md
@@ -177,14 +177,16 @@ terminal(command="tmux send-keys -t agent1 'Add rate limiting middleware' && sle
terminal(command="tmux send-keys -t agent1 '/exit' && sleep 0.5 && tmux send-keys -t agent1 Enter && sleep 2 && tmux kill-session -t agent1", timeout=10)
```
-**No tmux** (`command -v tmux` prints nothing, e.g. an older Hermes Docker image): run Hermes as a PTY background process and drive it with `process_manage`. Stdin only exists with `pty=true`. Send the text and the Enter key (`"\r"`) as two separate `write` calls, for the same reason as with tmux; `submit` appends `"\n"`, which Hermes reads as a newline, never as Enter.
+**No tmux** (`command -v tmux` prints nothing, e.g. an older Hermes Docker image): run Hermes as a PTY background process and drive it with `process_manage`. Stdin only exists with `pty=true`. Send the text, pause, then send the Enter key (`"\r"`) as its own `write`, for the same reason as with tmux: an Enter that arrives right after the text is read as part of a paste and becomes a newline. Use `write`, not `submit`, for the Enter.
```
terminal(command="hermes", background=true, pty=true) # returns session_id
process_manage(action="write", session_id="<id>", data="Build a FastAPI auth service")
+terminal(command="sleep 0.5")
process_manage(action="write", session_id="<id>", data="\r")
process_manage(action="log", session_id="<id>", limit=40) # read the screen
process_manage(action="write", session_id="<id>", data="/exit")
+terminal(command="sleep 0.5")
process_manage(action="write", session_id="<id>", data="\r")
```
diff --git a/website/docs/user-guide/skills/bundled/productivity/productivity-docx.md b/website/docs/user-guide/skills/bundled/productivity/productivity-docx.md
index cbc5da4009f..d73e1466b0e 100644
--- a/website/docs/user-guide/skills/bundled/productivity/productivity-docx.md
+++ b/website/docs/user-guide/skills/bundled/productivity/productivity-docx.md
@@ -55,24 +55,22 @@ fields, and package health checks. It does not render documents itself
- Python 3.10+ with `python-docx` (import name `docx`; lxml comes with it).
- Pick the interpreter with `terminal`. Use `python` when it already imports
- the libraries (the Hermes Docker image ships them); otherwise use a
- persistent side environment under the Hermes home, which survives container
- restarts and never touches the Hermes install itself:
+ the libraries (the Hermes Docker image ships them); otherwise let Hermes
+ build its shared, pinned documents environment under the Hermes home. It
+ survives container restarts, never touches the Hermes install itself, and is
+ safe to run from several agents at once. Use this exact command in every
+ document skill so they all share one environment:
```bash
- export PY=python
- if ! "$PY" -c "import docx" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV" # new, or broken by a Python upgrade
- "$PY" -c "import docx" 2>/dev/null || "$PY" -m pip install -q python-docx
- fi
+ python -c "import docx" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+ export PY
"$PY" scripts/docx_create.py --help
```
- Run every helper below with `"$PY"`. On Windows the side interpreter is
- `%HERMES_HOME%\environments\documents\Scripts\python.exe`. Never
- `pip install` into the interpreter that runs Hermes.
+ Run every helper below with `"$PY"`. In PowerShell:
+ `$env:PY = hermes pm environment documents --extra documents --extra documents-pdf`.
+ Never `pip install` into the interpreter that runs Hermes or into this
+ environment; `hermes pm environment` owns it.
- Comments `add` uses the native API on python-docx >= 1.2 and an XML
fallback on older versions — both are automatic.
- For image blocks: the image files must exist locally (PNG/JPEG).
diff --git a/website/docs/user-guide/skills/bundled/productivity/productivity-pdf.md b/website/docs/user-guide/skills/bundled/productivity/productivity-pdf.md
index ee52e0b0e44..79cec54a82c 100644
--- a/website/docs/user-guide/skills/bundled/productivity/productivity-pdf.md
+++ b/website/docs/user-guide/skills/bundled/productivity/productivity-pdf.md
@@ -50,25 +50,23 @@ Create PDFs from structured specs, build and fill AcroForm forms (with layout li
- Python 3.10+ with `pypdf`, `reportlab`, `pdfplumber`.
- Pick the interpreter with `terminal`. Use `python` when it already imports
- the libraries (the Hermes Docker image ships them); otherwise use a
- persistent side environment under the Hermes home, which survives container
- restarts and never touches the Hermes install itself:
+ the libraries (the Hermes Docker image ships them); otherwise let Hermes
+ build its shared, pinned documents environment under the Hermes home. It
+ survives container restarts, never touches the Hermes install itself, and is
+ safe to run from several agents at once. Use this exact command in every
+ document skill so they all share one environment:
```bash
- export PY=python
- if ! "$PY" -c "import pypdf, reportlab, pdfplumber" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV" # new, or broken by a Python upgrade
- "$PY" -c "import pypdf, reportlab, pdfplumber" 2>/dev/null || "$PY" -m pip install -q pypdf reportlab pdfplumber
- fi
+ python -c "import pypdf, reportlab, pdfplumber" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+ export PY
"$PY" scripts/pdf_create.py --help
```
- Run every helper below with `"$PY"`. On Windows the side interpreter is
- `%HERMES_HOME%\environments\documents\Scripts\python.exe`. Never
- `pip install` into the interpreter that runs Hermes.
-- Optional, for page rasterization (`pdf_page_image.py`, overlay rendering): `pypdfium2` installed into that side environment (`"$DOCS_ENV/bin/python" -m pip install pypdfium2`, then use it as `$PY`), or poppler's `pdftoppm` on PATH. Scripts fall back pypdfium2 → pdftoppm and report `{"rendered": false, "missing": [...]}` (exit 0) when neither exists.
+ Run every helper below with `"$PY"`. In PowerShell:
+ `$env:PY = hermes pm environment documents --extra documents --extra documents-pdf`.
+ Never `pip install` into the interpreter that runs Hermes or into this
+ environment; `hermes pm environment` owns it.
+- Page rasterization (`pdf_page_image.py`, overlay rendering) uses `pypdfium2`, which the documents environment already has (if your `python` lacks it, switch `PY` to that environment with the command above), or poppler's `pdftoppm` on PATH. Scripts fall back pypdfium2 → pdftoppm and report `{"rendered": false, "missing": [...]}` (exit 0) when neither exists.
- Each helper script checks imports lazily and prints an install hint if a dependency is missing.
## How to Run
diff --git a/website/docs/user-guide/skills/bundled/productivity/productivity-powerpoint.md b/website/docs/user-guide/skills/bundled/productivity/productivity-powerpoint.md
index 6900ad8940c..8db3ed935c4 100644
--- a/website/docs/user-guide/skills/bundled/productivity/productivity-powerpoint.md
+++ b/website/docs/user-guide/skills/bundled/productivity/productivity-powerpoint.md
@@ -52,24 +52,22 @@ and slide rendering — all offline, no PowerPoint installation required.
- Python 3.10+ with `python-pptx` (import name `pptx`).
- Pick the interpreter with `terminal`. Use `python` when it already imports
- the libraries (the Hermes Docker image ships them); otherwise use a
- persistent side environment under the Hermes home, which survives container
- restarts and never touches the Hermes install itself:
+ the libraries (the Hermes Docker image ships them); otherwise let Hermes
+ build its shared, pinned documents environment under the Hermes home. It
+ survives container restarts, never touches the Hermes install itself, and is
+ safe to run from several agents at once. Use this exact command in every
+ document skill so they all share one environment:
```bash
- export PY=python
- if ! "$PY" -c "import pptx" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV" # new, or broken by a Python upgrade
- "$PY" -c "import pptx" 2>/dev/null || "$PY" -m pip install -q python-pptx
- fi
+ python -c "import pptx" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+ export PY
"$PY" scripts/pptx_create.py --help
```
- Run every helper below with `"$PY"`. On Windows the side interpreter is
- `%HERMES_HOME%\environments\documents\Scripts\python.exe`. Never
- `pip install` into the interpreter that runs Hermes.
+ Run every helper below with `"$PY"`. In PowerShell:
+ `$env:PY = hermes pm environment documents --extra documents --extra documents-pdf`.
+ Never `pip install` into the interpreter that runs Hermes or into this
+ environment; `hermes pm environment` owns it.
- Optional: LibreOffice (`soffice`) plus poppler (`pdftoppm` or
`pdftocairo`) for rendering slides to PNGs and for PDF export.
`pptx_render.py` detects both with `shutil.which` and degrades
diff --git a/website/docs/user-guide/skills/bundled/productivity/productivity-xlsx.md b/website/docs/user-guide/skills/bundled/productivity/productivity-xlsx.md
index 3ece82fa551..ff98a23d105 100644
--- a/website/docs/user-guide/skills/bundled/productivity/productivity-xlsx.md
+++ b/website/docs/user-guide/skills/bundled/productivity/productivity-xlsx.md
@@ -58,24 +58,22 @@ scripts are argparse CLIs that print JSON and use explicit UTF-8 I/O.
- Python 3.10+ with `openpyxl`. No other third-party packages are
needed; everything else is stdlib.
- Pick the interpreter with `terminal`. Use `python` when it already imports
- the libraries (the Hermes Docker image ships them); otherwise use a
- persistent side environment under the Hermes home, which survives container
- restarts and never touches the Hermes install itself:
+ the libraries (the Hermes Docker image ships them); otherwise let Hermes
+ build its shared, pinned documents environment under the Hermes home. It
+ survives container restarts, never touches the Hermes install itself, and is
+ safe to run from several agents at once. Use this exact command in every
+ document skill so they all share one environment:
```bash
- export PY=python
- if ! "$PY" -c "import openpyxl" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV" # new, or broken by a Python upgrade
- "$PY" -c "import openpyxl" 2>/dev/null || "$PY" -m pip install -q openpyxl
- fi
+ python -c "import openpyxl" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+ export PY
"$PY" scripts/xlsx_create.py --help
```
- Run every helper below with `"$PY"`. On Windows the side interpreter is
- `%HERMES_HOME%\environments\documents\Scripts\python.exe`. Never
- `pip install` into the interpreter that runs Hermes.
+ Run every helper below with `"$PY"`. In PowerShell:
+ `$env:PY = hermes pm environment documents --extra documents --extra documents-pdf`.
+ Never `pip install` into the interpreter that runs Hermes or into this
+ environment; `hermes pm environment` owns it.
- Optional: LibreOffice (`soffice`) for headless recalculation or
format conversion.
diff --git a/website/docs/user-guide/skills/optional/finance/finance-excel-author.md b/website/docs/user-guide/skills/optional/finance/finance-excel-author.md
index e27251af3d2..c525b934b0c 100644
--- a/website/docs/user-guide/skills/optional/finance/finance-excel-author.md
+++ b/website/docs/user-guide/skills/optional/finance/finance-excel-author.md
@@ -43,18 +43,15 @@ Adapted from Anthropic's `xlsx-author` and `audit-xls` skills in the [anthropics
## Setup
-Use `python` when it already imports `openpyxl` (the Hermes Docker image
-ships it). Otherwise install into a persistent side environment under the
-Hermes home, never into the interpreter that runs Hermes:
+Use `python` when it already imports `openpyxl` (the Hermes Docker image ships
+it). Otherwise let Hermes build its shared, pinned documents environment
+under the Hermes home (the same command as the docx/xlsx/powerpoint/pdf
+skills; safe to run from several agents at once), and never `pip install`
+into the interpreter that runs Hermes:
```bash
-export PY=python
-if ! "$PY" -c "import openpyxl" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV"
- "$PY" -c "import openpyxl" 2>/dev/null || "$PY" -m pip install -q "openpyxl>=3.0"
-fi
+python -c "import openpyxl" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+export PY
```
Run the model-building Python with `"$PY"`.
diff --git a/website/docs/user-guide/skills/optional/finance/finance-pptx-author.md b/website/docs/user-guide/skills/optional/finance/finance-pptx-author.md
index 86095104a35..58298847f27 100644
--- a/website/docs/user-guide/skills/optional/finance/finance-pptx-author.md
+++ b/website/docs/user-guide/skills/optional/finance/finance-pptx-author.md
@@ -45,17 +45,14 @@ For the broader, already-shipped PowerPoint authoring skill (slides, speaker not
## Setup
Use `python` when it already imports `pptx` (the Hermes Docker image ships
-it). Otherwise install into a persistent side environment under the Hermes
-home, never into the interpreter that runs Hermes:
+it). Otherwise let Hermes build its shared, pinned documents environment
+under the Hermes home (the same command as the docx/xlsx/powerpoint/pdf
+skills; safe to run from several agents at once), and never `pip install`
+into the interpreter that runs Hermes:
```bash
-export PY=python
-if ! "$PY" -c "import pptx" 2>/dev/null; then
- DOCS_ENV="${HERMES_HOME:-$HOME/.hermes}/environments/documents"
- PY="$DOCS_ENV/bin/python"
- "$PY" -c "" 2>/dev/null || python -m venv --clear "$DOCS_ENV"
- "$PY" -c "import pptx" 2>/dev/null || "$PY" -m pip install -q "python-pptx>=0.6"
-fi
+python -c "import pptx" 2>/dev/null && PY=python || PY="$(hermes pm environment documents --extra documents --extra documents-pdf)"
+export PY
```
Run the deck-building Python with `"$PY"`.