agentleFS
z3e8z3e8/pyharness/AGENTS.md

pyharness

AGENTS.md0 starsChanged 4 months agoApache-2.0View on GitHub

Context for AI coding agents working in this repo. Keep this file to non-inferable facts (commands, layout, conventions, gotchas) — not things you can read from the code. Universal working-style rules live in the global ~/.claude/CLAUDE.md, loaded automatically. The default change workflow lives in the global dev-workflow skill; this file adds the pyharness-specific commands, layout, and conventions it needs. pyharness — a CodeAct agent with a containment and audit layer. The orchestrator either replies with text or emits one run_python…

  • Reads credentials
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Only evals/demo/site is published.

    line 51
  2. Very specific:

    Every capability the agent can call goes through broker/dispatch.py — add new ones there, not by scattering I/O across modules.

    line 90
  3. Very specific:

    Keep it minimal by design — a few active files, no scratch buildup.

    line 117

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Context for AI coding agents working in this repo. Keep this file to non-inferable facts (commands, layout, conventions, gotchas) — not things you can read from the code. Universal working-style rules live in the global ~/.claude/CLAUDE.md, loaded automatically. The default change workflow lives in the global dev-workflow skill; this file adds the pyharness-specific commands, layout, and conventions it needs.

What this is

pyharness — a CodeAct agent with a containment and audit layer. The orchestrator either replies with text or emits one run_python call that the harness runs in a persistent Jupyter-style kernel. No fine-grained JSON tools; capabilities are builtins in scope or tools imported on demand. See docs/explanation/ for the model.

Commands

Everything is driven by make (make help lists all targets). uv is the package manager; there is no pip/venv step to run by hand.

make setup     # create .env + install editable package + dev toolchain (one-time)
make test      # tests + the adversarial suite — no API key needed. Use this to verify changes.
make evals     # run the adversarial suite alone and rewrite evals/SCOREBOARD.md (commit the diff)
make lint      # ruff check + ruff format --check (what CI checks when triggered)
make format    # ruff format + ruff check --fix (apply autofixes)
make typecheck # mypy — lenient, non-blocking (see [tool.mypy] in pyproject.toml)
make run       # interactive agent + live viewer :6061 (needs ANTHROPIC_API_KEY in .env)
make watch     # live viewer alone (tails .sessions/) for a session started elsewhere
make site      # re-bake the committed evidence site (evals/demo/site) — commit the diff
make up        # optional Phoenix OTel backend (:6006); make down stops it

The dev toolchain (ruff, mypy, pytest) is pinned in the dev dependency group ([dependency-groups] in pyproject.toml); make setup installs it. CI (.github/workflows/) is manual-only (workflow_dispatch) — nothing fires on push or PR; start a run with gh workflow run test.yml. It runs make test across Python 3.11/3.12/3.13 plus a ruff check, with mypy as a non-blocking signal. Because nothing runs automatically, the local checks are the real gate: run make test and make lint yourself. Do not wire coverage into the default pytest run — pytest-cov breaks the sandbox child's re-exec (6 tests).

pages.yml is workflow_dispatch-only for the same reason, and this one bites: it publishes evals/demo/site to https://z3e8.github.io/pyharness/, so committing a re-baked page does not update the live site. A clean repo is not a clean site. After any change to the committed pages — a make site re-bake, a redaction, a fix — run gh workflow run pages.yml and then verify over HTTP (curl https://z3e8.github.io/pyharness/<page>), not just in git. Only evals/demo/site is published; evals/data/site is repo-only.

To test-drive the harness itself (run a probe task, inspect what happened, fix, re-run) use the headless CLI — the harness-loop skill has the full loop:

uv run pyharness run "probe task" --json   # headless one-shot; digest on stdout, exit code = outcome (needs API key)
uv run pyharness show [--transcript]       # inspect the latest session — no API key, low context

Direct equivalents without make: uv run pytest -q, uv run pyharness. Config lives in a single .env (copied from .env.example); the Makefile and docker-compose both read it — do not export env vars by hand.

Repo map

Folder names are visible from ls; this table is the meaning — where the load-bearing seams are.

PathWhat lives here
pyharness/core/session.py, agent.py, kernel.py, workspace.py, media.py (image blocks back to the model), session_venv.py (per-session venv, out-of-process only) — the orchestration loop and persistent kernel
pyharness/broker/dispatch.py — the single choke point every capability call routes through (policy → audit → budget → execute); capabilities/ — 16 registered capabilities (browser, files, history, http, inbox, llm, notify, obs, packages, search, secrets, shell, skills, spawn, tools, web) plus three helper modules that register nothing (exa, page, payload); enumerate them from the live broker rather than this list — tests/test_capability_policies.py does; remote/ — the out-of-process child (child.py, host.py, protocol.py, sandbox.py)
pyharness/security/policy.py, grants.py (scoped approval grants), vault.py, profiles.py (encrypted browser login profiles), totp.py (RFC 6238 codes from vault seeds), sink.py (per-context secret masking) — action policy + the encrypted secrets vault
pyharness/tools/registry.py, skills.py — tool discovery (search_tools/use_tool) and saved skills; mcp/ — MCP server client/config/transport
pyharness/llm/client.py — Anthropic client wrapper
pyharness/cli/console-script entry points, one module each: main.py (pyharness), vault.py, profiles.py, index.py, mcp.py
pyharness/obs/read-side observability: transcript.py (shared session views: digest, flattened transcript, outcome vocabulary), index.py (derived SQLite session index), page.py + assets/ (the one HTML shell, stylesheet, markdown renderer and event renderer behind every surface — live viewer, baked pages, site index, eval boards; assets are real .css/.js files, inlined at render time), watch.py (live session viewer, pyharness-watch; owns the server and render_page(feed)), static.py (bakes finished sessions and markdown boards into self-contained HTML using that same renderer — pyharness-watch --static, make site), telemetry.py (opt-in OTel export), trace.py
pyharness/ (top)audit.py (hash-chained log), budget.py, util.py, reflect.py + lessons.py (post-session self-improvement pass, opt-in)
tests/pytest suite; mcp_server_fake.py is a test double
evals/four suites. Adversarial: scoreboard.py (scoring model), support.py (verdict helpers + offline network fixtures), attacks/ (one module per defended claim), run.py (make evals), SCOREBOARD.md (the committed artifact). Demo (demo/): ten end-to-end tasks against a loopback corpus, python -m evals.demo.run [--baseline], artifacts demo/COMPARISON.md (the board) and demo/site/ (the same ten sessions as static viewer pages, plus all three boards rendered into the same site — committed because .sessions/ is not; make site). Skill cost curve (skills/): two task arms (retrieval / discovery), each run five times over its own shared skills root, python -m evals.skills.run [--arm NAME] (--rescore ROOT re-derives the boards from finished sessions, free), artifact skills/CURVE.md; it reuses the demo's corpus and server. Throughput (data/): one task, three arms (brokered / conventional file tools / shell), asked three questions about a month of gzipped service logs with five defects planted in it — the suite for the competence claim rather than the containment ones. gen.py regenerates the ~50MB corpus from a seed (never committed) and derives the answer key by reading the written bytes back; python -m evals.data.run, make evals-data, artifact data/BOARD.md. All four run under make test; the demo's, the curve's and the throughput suite's model calls do not — see demo/corpus/README.md, skills/CURVE.md and data/BOARD.md for what each does and does not claim
deploy/observability/docker-compose for the optional OTel backends: Phoenix, and Langfuse (heavier profile)
docs/documentation — explanation / how-to / reference (see docs/index.md)
.claude/skills/docs/the docs skill: how to use and maintain the docs
.claude/skills/harness-loop/the harness-loop skill: run→observe→fix loop for coding agents testing the harness

Conventions

  • Python ≥ 3.11. Match surrounding style; keep changes surgical.
  • Every capability the agent can call goes through broker/dispatch.py — add new ones there, not by scattering I/O across modules.
  • The audit log is a tamper-evident hash chain; verify with make verify-audit DIR=.sessions/<name>.
  • A change that alters behavior, a builtin, a flag, or a config var updates the matching docs/ page in the same commit — reference pages track specific sources (builtins.md ↔ SYSTEM_PROMPT in agent.py, configuration.md ↔ .env.example, python-api.md ↔ __init__.py). The docs skill has the full sync map.

The agents/ folder

agents/ is local working space for agents (Claude Code included) to plan work that outlasts one session. If a task is too big to finish in one go, drop the plan and running progress here as a living TODO so the next agent resumes from it, and keep it current with what actually shipped. Keep it tidy: prune stale notes, and move finished or superseded files into agents/old/.

It is gitignored and its history was removed from the repo (2026-08-01). It is scaffolding for building the project, not part of it, and it does not travel between machines — back it up yourself if that matters. Nothing in it is load-bearing for the running code. Design rationale that is worth publishing goes to docs/explanation/design-decisions.md instead, written in the maintainer's voice; do not treat agents/decisions.md as its source, since one is a log of what agents chose autonomously and the other is a curated account of what the maintainer decided.

Keep it minimal by design — a few active files, no scratch buildup. Three standing docs anchor it: README.md (the index/map — keep current), issues.md (open-only known-issues log: append suspicions and fix them together later, then retire each resolved record to a dated old/resolved-issues-*.md so the file only ever lists open work), and decisions.md (append-only log of autonomous choices agents made and why). Working docs come in two types — plans (plan-*.md) and reports (*-report.md) — living flat at the top level; retire them to old/ once shipped or superseded. The orchestrate-workflow skill drives the fan-out-to-sub-agents loop over this backlog.

Gotchas

  • docs-legacy/ is gitignored local-only notes — do not treat it as current or wire anything to it. The live docs are docs/; agent scratch is agents/ (see above).
  • Session state lives under .sessions/ (gitignored). The agent's relative paths resolve inside its session workspace, not the repo root.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.