# NousResearch/hermes-agent · Version sync between pyproject.toml and __init__.py

## Open now

- Nothing open on GitHub.

These issues and PRs address a problem where the CLI version in __init__.py can fall out of sync with pyproject.toml, particularly during upgrade conflicts. The work involves adding version consistency checks to the hermes doctor command and reading the version from pyproject.toml as the source of truth.

## TL;DR

- 5 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 1 merged PR(s), 3 PR(s) closed without merging.
- A fix was merged to main in PR #35142. Verify it addresses your case.
- **Recommended:** read PR #35142 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `resolved` · deciding PR(s): `pr-35142`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.40`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #35070: Version mismatch: hermes_cli/__init__.py gets reverted during upgrade conflict resolution

## Prior & competing PRs

- **#35142: fix: detect version drift between pyproject.toml and __init__.py in hermes doctor**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `hermes_cli/doctor.py`
  - fix hunks:
  - `hermes_cli/doctor.py`

    ```diff
    @@ -204,6 +204,60 @@ def _fail_and_issue(text: str, detail: str, fix: str, issues: list[str]) -> None
         issues.append(fix)
     
     
    +def _read_pyproject_version() -> str | None:
    +    """Read the ``version = "..."`` from ``pyproject.toml`` at the project root.
    +
    +    Returns None when running from an installed wheel (no pyproject.toml ships
    +    with the package) or when the file can't be parsed. Reads only the
    +    ``[project]`` version, ignoring any version strings that appear in other
    +    tables.
    +    """
    +    pyproject = PROJECT_ROOT / "pyproject.toml"
    +    try:
    +        text = pyproject.read_text(encoding="utf-8")
    +    except OSError:
    +        return None
    +    in_project = False
    +    for raw in text.splitlines():
    +        line = raw.strip()
    +        if line.startswith("[") and line.endswith("]"):
    +            in_project = line == "[project]"
    +            continue
    +        if in_project and line.startswith("version") and "=" in line:
    +            value = line.split("=", 1)[1]
    +            value = value.split("#", 1)[0].strip().strip("\"'")
    +            return value or None
    +    return None
    +
    +
    +def _check_version_consistency(issues: list[str]) -> None:
    +    """Verify pyproject.toml version matches hermes_cli.__version__.
    +
    +    A git conflict resolution (reset/merge) can revert one file without the
    +    other, leaving ``hermes --version`` reporting a stale version while
    +    ``pyproject.toml`` is current. Detect that drift so users can re-sync.
    +    Silent no-op for installed wheels where pyproject.toml isn't present.
    +    """
    +    try:
    +        from hermes_cli import __version__ as init_version
    +    except Exception:
    +        return
    +    pyproject_version = _read_pyproject_version()
    +    if pyproject_version is None:
    +        # Installed wheel or unreadable pyproject — nothing to cross-check.
    +        return
    +    if pyproject_version == init_version:
    +        check_ok("Version files consistent", f"({init_version})")
    +    else:
    +        _fail_and_issue(
    +            "Version mismatch between source files",
    +            f"(pyproject.toml {pyproject_version} != hermes_cli/__init__.py {init_version})",
    +            "Re-sync version files (e.g. run 'hermes update', or set "
    +            "hermes_cli/__init__.py __version__ to match pyproject.toml)",
    +            issues,
    +        )
    +
    +
     def _check_s6_supervision(issues: list[str]) -> None:
         """Inside a container under our s6 /init, surface what s6 sees.
     
    ```

    ```diff
    @@ -509,6 +563,10 @@ def run_doctor(args):
             check_ok("Virtual environment active")
         else:
             check_warn("Not in virtual environment", "(recommended)")
    +
    +    # Detect drift between pyproject.toml and hermes_cli/__init__.py versions
    +    # (a git conflict resolution can silently revert one but not the other).
    +    _check_version_consistency(issues)
         
         _section("Required Packages")
         required_packages = [
    ```
- **#35160: fix(cli): read version from pyproject.toml to prevent stale version (#35070)**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `bb79bcde6103c564dacb2d796fe8fe8b775f1b18`, `#35142`
- **#35169: fix(doctor): add version consistency check between pyproject.toml and __init__.py**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#35172`
- **#35172: fix(cli): add version consistency check to hermes doctor**. closed without merge
  - maintainer direction: category `stale_abandoned`; implication `active`

## Fix status

- Merged to main in PR #35142 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-05-30`.
- Subsystem: `hermes_cli`
