Skip to main content

ContextPlate

CI PyPI Python License: MIT

Boilerplate for agent context. Declare it once; render it for every harness.

pipx install contextplate      # installs the `ctxplate` command
ctxplate init my-app

ContextPlate keeps one harness-neutral source of truth (AGENTS.md plus .agents/) and generates the native files each tool expects: Claude Code, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, and Aider. Any other tool that reads AGENTS.md works with no extra setup.

It scaffolds new projects, organizes existing ones, and never overwrites a file you edited.

            you edit                          ctxplate sync                 each tool reads
 ┌───────────────────────────┐                                    ┌──────────────────────────────┐
 │ AGENTS.md                 │                                    │ CLAUDE.md, .claude/...       │
 │ .agents/contextplate.toml    │ ─────────────────────────────────► │ .cursor/rules/*.mdc, ...     │
 │ .agents/rules/*.md        │                                    │ .github/instructions/, ...   │
 │ .agents/skills/*/SKILL.md │                                    │ .codex/agents/*.toml, ...    │
 │ .agents/agents/*.md       │                                    │ .gemini/settings.json, ...   │
 └───────────────────────────┘                                    └──────────────────────────────┘

Why

  • Every tool wants different files. Scoped rules use paths in Claude Code, globs in Cursor .mdc files, and applyTo in Copilot. Subagents are Markdown in one tool and TOML in another. Keeping them in sync by hand drifts within a week.
  • Context is a budget. Everything in an always-loaded file costs tokens on every turn. ContextPlate keeps the always-on layer small and moves the rest into rules, skills, and subagents that load only when relevant. ctxplate doctor measures it.
  • Instructions ask; config enforces. Protected paths become real permission rules and a pre-edit guard hook, not a sentence the model may ignore.

Quick start

Requires Python 3.11+. No runtime dependencies.

pipx install contextplate         # or: uvx contextplate ... (command: ctxplate)
# before the first PyPI release: pipx install git+https://github.com/deepskpathak/contextplate

# New project
ctxplate init my-app --preset python          # harnesses default to the agent CLIs on your PATH

# Existing repository (dry run first, then apply)
cd my-repo
ctxplate adopt                   # shows exactly what would change
ctxplate adopt --apply           # imports existing instructions, rules, skills, subagents, MCP servers

# Day to day
ctxplate sync                    # after editing anything in .agents/
ctxplate doctor                  # context budget, placeholders, portability, drift
ctxplate enable cursor           # add a harness later

What you get

my-app/
├── AGENTS.md                  # the always-on layer (you own it; two small blocks are managed)
├── CLAUDE.md                  # @AGENTS.md plus Claude-specific notes (managed block)
├── .agents/
│   ├── contextplate.toml         # harnesses, modules, commands, protected paths, MCP servers
│   ├── contextplate.lock.json    # what ContextPlate generated (commit it)
│   ├── rules/                 # scoped rules: `paths:` frontmatter, loaded on demand
│   ├── skills/                # Agent Skills (SKILL.md), read natively by Codex, Copilot, Cursor, Gemini
│   ├── agents/                # roles (subagents) in one neutral format
│   └── hooks/                 # guard, session snapshot, formatter (stdlib Python)
├── docs/                      # architecture, glossary, decisions/ (module: docs)
├── work/                      # handoff.md, plans/, scratch/ (module: work)
├── scripts/check.sh           # lint + types + tests, terse output (module: check_script)
└── generated per tool: .claude/  .cursor/  .github/{instructions,agents}/  .codex/  .gemini/  .aider.conf.yml

Optional ai_app module adds prompts/, evals/, and data/ with matching rules and read protection.

Supported harnesses

Instructions Scoped rules Skills Subagents MCP Hooks
Claude Code CLAUDE.md imports AGENTS.md .claude/rules/ .claude/skills/ (copied) .claude/agents/ .mcp.json guard, snapshot, format
Codex AGENTS.md (native) index in AGENTS.md .agents/skills/ (native) .codex/agents/*.toml .codex/config.toml block
Copilot AGENTS.md (native) .github/instructions/ .agents/skills/ (native) .github/agents/ .mcp.json
Cursor AGENTS.md (native) .cursor/rules/*.mdc .agents/skills/ (native) .cursor/agents/ .cursor/mcp.json
Gemini CLI .gemini/settings.json points at AGENTS.md index in AGENTS.md .agents/skills/ .gemini/agents/ .gemini/settings.json
Aider .aider.conf.yml reads AGENTS.md index in AGENTS.md
Anything else AGENTS.md index in AGENTS.md .agents/skills/ read the role file

Formats were checked against each vendor's documentation; see docs/harnesses.md for sources and caveats.

How it stays safe

  • Your edits win. ContextPlate records a hash for every file it writes. A generated file you changed is reported as a conflict and left alone unless you pass --force. Whitespace-only changes (formatters) are not conflicts.
  • Managed blocks, not takeovers. In files you own (AGENTS.md, CLAUDE.md, .gitignore, .codex/config.toml), ContextPlate edits only its marked block. In JSON configs (.claude/settings.json, .mcp.json, .gemini/settings.json) it merges its keys and later removes only what it added.
  • Adopt is a dry run by default. With --apply, originals that would be duplicated are moved to .agents/imported/*.bak, never deleted.
  • Hooks are small and local. Standard-library Python, no network, no telemetry. Read them in .agents/hooks/.

Concepts

  • Four context tiers: always on (AGENTS.md), on demand (rules, skills, docs), session state (work/handoff.md plus a git snapshot injected at start), isolated (subagents return summaries). See docs/concepts.md.
  • Neutral formats: rules use paths:; skills follow the Agent Skills spec with tool hints under metadata; roles use neutral tools (read, search, web, shell, edit) and model tiers (fast, strong, inherit). Tool-specific extras use prefixed keys such as claude.memory: project.
  • Lightly opinionated: presets (generic, python, node, go, rust, jvm) and modules (docs, work, ai_app, hooks, check_script) are defaults, not requirements. Everything is a line in .agents/contextplate.toml.

Commands

Command What it does
ctxplate init [dir] Scaffold a new project. --preset, --harness a,b|all|none, --with / --without modules
ctxplate adopt [dir] Organize an existing repo. Dry run unless --apply; --minimal imports only
ctxplate sync Regenerate harness files. --check for CI, --dry-run, --force
ctxplate doctor Budget, placeholders, skill portability, drift. --strict fails on warnings
ctxplate enable/disable <harness> Edit the harness list and sync
ctxplate list Show harnesses, presets, and modules

In CI and pre-commit

Fail builds when generated files drift: run ctxplate sync --check in CI, or add the hook to .pre-commit-config.yaml:

- repo: https://github.com/deepskpathak/contextplate
  rev: v0.1.0
  hooks:
    - id: ctxplate-sync-check
    - id: ctxplate-doctor        # optional

Configuration

See docs/configuration.md for every key and the canonical file formats. A taste:

harnesses = ["claude", "codex", "copilot", "cursor", "gemini"]

[project]
name = "my-app"
preset = "python"

[commands]
test = "pytest -q"
lint = "ruff check ."

[protect]
no_read = [".env", ".env.*", "!.env.example"]
no_edit = [".env", ".env.*", "!.env.example", ".git/**", "uv.lock"]

[mcp.servers.docs]
url = "https://mcp.context7.com/mcp"

FAQ

Should I commit the generated files? Yes. Teammates and cloud agents read them directly, and nobody needs ContextPlate installed to benefit. Run ctxplate sync --check in CI to catch drift.

Can I edit a generated file? You can, and ContextPlate will not overwrite it. The better path is to edit the source in .agents/ so every tool gets the change.

Why do Copilot and Cursor show a skill twice? Both tools read .claude/skills/ as well as .agents/skills/. Claude Code only reads .claude/skills/, so the copy is needed when Claude is enabled.

Windows? Supported. Set [hooks] python = "py" (or "python") and run scripts/check.sh from Git Bash or WSL.

A tool changed its format. Open an issue with a link to the vendor's docs. Adapters are small, single-file modules; see CONTRIBUTING.md.

Related projects. Other tools also sync rules across agents (for example ruler and rulesync). ContextPlate's focus is the whole context system: scaffolding, adopting existing repos, skills, subagents, MCP, enforcement, and a measured context budget.

Contributing

Issues and pull requests are welcome. Start with CONTRIBUTING.md. Security reports: SECURITY.md.

License

MIT.

The files ContextPlate generates or copies into your project (AGENTS.md blocks, rules, skills, roles, hooks, configs, and starter docs) are yours. Use them under any license you like, with no attribution or license notice required.

Metadata

Release files for contextplate 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for contextplate 0.1.1
File Size Uploaded Provenance Actions
contextplate-0.1.1.tar.gz 60.0 kB With provenance Details for contextplate-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for contextplate 0.1.1
File Interpreter ABI Platform Actions
contextplate-0.1.1-py3-none-any.whl Python 3 none any Details for contextplate-0.1.1-py3-none-any.whl

Total release size: 125.4 kB

Release files / contextplate-0.1.1.tar.gz

Download URL contextplate-0.1.1.tar.gz
Size 60.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d63092434d7658f5fa288f0c45540493d5cbc25e57d0c7fe2e7d99a5d7948f83
BLAKE2b-256 checksum
How to use checksums
8bafde62d5402158729b825bb995efbcf9c54b957a92ad5a092a0148c393148c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / contextplate-0.1.1-py3-none-any.whl

Download URL contextplate-0.1.1-py3-none-any.whl
Size 65.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d78a57795c4a92067d7e083a796b05aec62751589e6a508a9db1fb9ae5a63781
BLAKE2b-256 checksum
How to use checksums
679f5c19a375face1e848bba970cdad06f30cdad2e36bf704834ec5117f84147
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for contextplate 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for contextplate-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page