Skip to main content

Drop-in documentation contract for multi-agent (and human + agent) collaboration on a shared codebase.

Project description

Agent Collab Treaty

A drop-in template for the documentation contract that lets multiple coding agents (Claude, Codex, future tools) collaborate productively on the same repository.

What This Is

A small, opinionated set of root-level Markdown files that any agent reads at the start of a session to know:

  • what environment to run in,
  • what's active code versus legacy,
  • what work is currently in flight,
  • what was done in recent sessions,
  • and what conventions to follow for commits and code style.

The template is language- and framework-agnostic. It works whether the project is Python, JavaScript, Go, Rust, or a mix — you fill in the project-specific details, the structure stays the same.

What's In The Template

File Purpose
AGENTS.md First-read contract. Startup rule, documentation map, runtime env, common task recipes, git/commit conventions, project-specific reminders. Both Codex and Claude Code / Cowork recognize this file by convention.
project_overview.md Orientation doc. Active vs. legacy code map, repo structure, recommended read order. The single most valuable artifact for an agent that's never seen the codebase.
next_steps.md The roadmap. A "Currently Hot" pointer at the top names the active threads so an agent doesn't have to scroll.
work_log.md Session journal, newest-on-top. Holds at most the 5 most recent unique calendar dates. Each agent session prepends a structured entry before handoff.
work_log_archive/ Directory of rotated 5-date chunks from work_log.md. Each file is named work_log_<earliest>_to_<latest>.md and holds exactly 5 dates. Keeps the live log cheap to load.

How To Use

The fastest path is the treaty CLI, which scaffolds (and later updates) the treaty files in any project — new or existing.

Option 1 — install the CLI, then run treaty init

# isolated install (recommended; requires pipx)
pipx install agent-collab-treaty

# or in a regular venv
pip install agent-collab-treaty

# then, from inside the project you want to add the treaty to:
treaty init

treaty init asks a few short questions (integration branch, env activation command, test command) and drops the treaty files into the current directory. Re-run later with treaty update to pull in upstream refinements without losing your local edits.

Note: treaty update requires the target project to be a git-tracked repo (Copier uses git for three-way merges). If your project isn't a git repo yet, run git init && git add . && git commit -m "treaty baseline" once before the first treaty update.

Non-interactive use:

treaty init . --defaults \
  --data integration_branch=main \
  --data env_activation='conda activate myenv' \
  --data test_command='pytest -v -m "not slow"'

Option 2 — use Copier directly (no install)

The CLI is a thin wrapper around Copier. If you'd rather not install another tool:

pipx run copier copy gh:yzhaoinuw/agent_collab_treaty .

Option 3 — just copy the files

Old-school: copy from the template/ directory of this repo into your project — not the repo root, which holds the treaty's own dogfooded versions (real session entries, real next-steps threads). The template/AGENTS.md.jinja file uses Jinja markers like {{ integration_branch }}; replace those by hand with your values and rename to AGENTS.md. The other files (work_log.md, next_steps.md, project_overview.md, work_log_archive/) are plain Markdown — copy as-is and fill in the [...] bracket placeholders.

Whichever path you pick, future agent sessions will read the files automatically. As work progresses, prepend new entries to work_log.md and keep next_steps.md honest about what's currently hot.

Wiring Up Your Agent

The template is intentionally agent-agnostic — it does not ship CLAUDE.md, CODEX.md, GEMINI.md, or any other vendor-specific pointer file. AGENTS.md is the one file every agent should read at the start of a session, but not every tool looks for that name by default. Configure the tool(s) you actually use so they always read AGENTS.md first:

  • Codex and Claude Code / Cowork recognize AGENTS.md by convention — no extra configuration needed.
  • For any other tool, add a one-line default instruction (system prompt, custom instructions, or equivalent) such as: "At the start of every new chat or session in this repository, read AGENTS.md first and follow the documentation map there."
  • If your tool only reads a vendor-specific file (e.g. CLAUDE.md, GEMINI.md), create that pointer locally — the .gitignore already excludes those filenames so they stay on your machine and the template repo remains vendor-neutral.

The Workflow In Practice

When a new agent session opens in a repo that uses this template:

  1. Read AGENTS.md first. Its Startup Rule tells the agent not to auto-load every Markdown file, and its Documentation section is the map of which other docs to open for which kind of task.
  2. From the documentation map, skim project_overview.md if the task touches an unfamiliar area, or jump straight to the relevant doc otherwise.
  3. Read the top of work_log.md to pick up in-flight context. Use the cheap-read recipe in AGENTS.md to load only the most recent entries rather than the whole file.
  4. Check next_steps.md → "Currently Hot" for the active priorities.
  5. Do the work, following the conventions in AGENTS.md.
  6. Before commit: run the pre-flight checklist from AGENTS.md and prepend a structured entry to work_log.md.

Rotation Policy

work_log.md grows linearly over time. The template's policy keeps the live file cheap to load by rotating in fixed-size chunks:

  • The live work_log.md holds at most the 5 most recent unique calendar dates.

  • When prepending a new date would push the live log past 5 unique dates, move the oldest 5 dates as a chunk into a new file at work_log_archive/work_log_<earliest>_to_<latest>.md. Each archive file holds exactly 5 dates.

  • All files (live and archive) use the same ## YYYY-MM-DD header convention, so the anchor-grep recipe in AGENTS.md works across both with one command:

    rg -n '^## [0-9]{4}-[0-9]{2}-[0-9]{2}' work_log.md work_log_archive/
    

Why "Treaty"

Because it's a small, deliberate agreement between humans and agents about how they'll work together on the same code — what each side reads, what each side writes, where context lives, and how it stays current. Drop it into any repo and every agent that walks in inherits the same contract.

Releasing to PyPI

(This section is for maintainers of this repo. End users should follow How To Use instead.)

Two GitHub Actions workflows handle publishing:

  • .github/workflows/release.yml — fires on a v* tag push, builds sdist + wheel, publishes to PyPI, and creates a GitHub Release.
  • .github/workflows/test-publish.ymlworkflow_dispatch (manual) trigger, publishes to TestPyPI for dry-runs.

Both use PyPI Trusted Publishing (OIDC), so no API tokens are stored in the repo.

One-time setup (per maintainer)

  1. PyPI account: create one at https://pypi.org if you don't have one.
  2. TestPyPI account: create a separate one at https://test.pypi.org. (TestPyPI is fully independent and uses different credentials.)
  3. Register the project as a Pending Publisher on PyPI:
    • Go to https://pypi.org/manage/account/publishing/
    • Click "Add a new pending publisher"
    • Fill in: PyPI project name agent-collab-treaty, owner yzhaoinuw, repo agent_collab_treaty, workflow filename release.yml, environment name pypi.
  4. Register on TestPyPI the same way:
  5. Create the two GitHub environments: in repo Settings → Environments, create pypi and testpypi. No secrets needed (OIDC handles auth). Optionally add protection rules (e.g., require manual approval for pypi).

Cutting a release

Dry-run first:

# in the GitHub Actions tab → "Publish to TestPyPI (manual dry-run)" → Run workflow
# (or via CLI:)
gh workflow run test-publish.yml

After the TestPyPI publish succeeds, install from TestPyPI to smoke-test:

pipx install --index-url https://test.pypi.org/simple/ \
  --pip-args="--extra-index-url https://pypi.org/simple/" \
  agent-collab-treaty

When the dry-run looks good, cut the real release:

# bump pyproject.toml version if needed, then:
git tag v0.1.0
git push origin v0.1.0
# release.yml will fire, publish to PyPI, and create a GitHub Release

Customization

Treat this as a starting point, not a fixed standard. Common per-project additions:

  • A "Pre-commit Note" or "CI Note" section in AGENTS.md with the specific commands your stack uses (e.g., Black + pytest for Python, Prettier + Jest for JS).
  • A "Domain Reminders" section in AGENTS.md for non-obvious gotchas (e.g., "don't blow away debug breadcrumbs during pipeline iteration").
  • Subsections of project_overview.md for the architecture diagrams or data schemas that matter most.

Keep additions coherent with the existing structure rather than rewriting it — the value of a shared template is that every repo looks the same to the next agent.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_collab_treaty-0.1.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_collab_treaty-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file agent_collab_treaty-0.1.0.tar.gz.

File metadata

  • Download URL: agent_collab_treaty-0.1.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for agent_collab_treaty-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8a3327cf90b4a0b39765aa4486d26bc05be9f31c5b71b031cc0ce57c9fcfc01
MD5 605cd517ff5bbf0f7f6d92046c2688fa
BLAKE2b-256 47a83c36dcbbe3d5add7aa1cc35dcae5d38906b1a9a4a546d050590cc25ed87f

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_collab_treaty-0.1.0.tar.gz:

Publisher: release.yml on yzhaoinuw/agent_collab_treaty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_collab_treaty-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_collab_treaty-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4afadf35e407e5f937cfb6226db626c8975cc0f37546f02907068c00c909f0
MD5 2a819dc4fe6131e6812d52b8cfa70977
BLAKE2b-256 a590a5df6e7fd19283fb98cf3d73af922997cc4885132652951d9fc83d142120

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_collab_treaty-0.1.0-py3-none-any.whl:

Publisher: release.yml on yzhaoinuw/agent_collab_treaty

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page