项目文件夹

文件
tjb-tech 5dd8b952ec Initial release: oh — OpenHarness: Open Agent Harness v0.1.0
A lightweight open-source Python implementation of the Agent Harness architecture.
44x lighter than Claude Code (11K vs 512K lines), 98% core tool coverage.

- 43 tools with Pydantic validation and parallel execution
- Skills system compatible with anthropics/skills (17+ tested)
- Plugin system compatible with claude-code/plugins (12+ tested)
- API retry with exponential backoff
- Multi-level permissions with path rules
- React/Ink TUI with "Oh my Harness!" branding
- 114 unit tests + 6 E2E test suites
- MIT License
2026-04-01 16:32:25 +00:00

53 行
1.7 KiB
Python

"""Tests for memory helpers."""
from __future__ import annotations
from pathlib import Path
from openharness.memory import (
find_relevant_memories,
get_memory_entrypoint,
get_project_memory_dir,
load_memory_prompt,
)
def test_memory_paths_are_stable(tmp_path: Path, monkeypatch):
monkeypatch.setenv("OPENHARNESS_DATA_DIR", str(tmp_path / "data"))
project_dir = tmp_path / "repo"
project_dir.mkdir()
memory_dir = get_project_memory_dir(project_dir)
entrypoint = get_memory_entrypoint(project_dir)
assert memory_dir.exists()
assert entrypoint.parent == memory_dir
def test_load_memory_prompt_includes_entrypoint(tmp_path: Path, monkeypatch):
monkeypatch.setenv("OPENHARNESS_DATA_DIR", str(tmp_path / "data"))
project_dir = tmp_path / "repo"
project_dir.mkdir()
entrypoint = get_memory_entrypoint(project_dir)
entrypoint.write_text("# Index\n- [Testing](testing.md)\n", encoding="utf-8")
prompt = load_memory_prompt(project_dir)
assert prompt is not None
assert "Persistent memory directory" in prompt
assert "Testing" in prompt
def test_find_relevant_memories(tmp_path: Path, monkeypatch):
monkeypatch.setenv("OPENHARNESS_DATA_DIR", str(tmp_path / "data"))
project_dir = tmp_path / "repo"
project_dir.mkdir()
memory_dir = get_project_memory_dir(project_dir)
(memory_dir / "pytest_tips.md").write_text("Pytest markers and fixtures\n", encoding="utf-8")
(memory_dir / "docker_notes.md").write_text("Docker compose caveats\n", encoding="utf-8")
matches = find_relevant_memories("fix pytest fixtures", project_dir)
assert matches
assert matches[0].path.name == "pytest_tips.md"