A pipx-first CLI for architecture-aware collaboration between humans and coding agents.
Project description
enclosure
enclosure is a small CLI for making coding agents architecture-aware inside a real repository.
It creates a project-local contract in .enclosure/: rules, architecture boundaries, dependency flow, file-shape constraints, and scaffolding recipes that agents can read before they edit and checks can validate after they edit.
You do not have to hand-author the whole contract. The intended workflow is to ask an agent to inspect the repository, initialize enclosure, draft the rules and config from the code that already works, and then refine the result with you.
The name is literal. Every agent coding task starts inside the enclosure. If the agent jumps the fence by crossing a boundary, importing through the wrong layer, inventing a module shape, or ignoring local guidance, the loop makes that visible quickly: read the contract, change the code, run the checks, steer back.
Why Architects Should Care
Agentic coding fails less from syntax mistakes than from architectural amnesia.
An agent can search files, but it does not automatically know:
- which module owns a responsibility;
- where the public seam is;
- which layers may depend on which other layers;
- what local rules matter before touching this repo;
- what shape new files and modules should take;
- how to tell when it has crossed the fence.
enclosure moves that knowledge out of memory, review comments, and scattered docs and puts it in a repo-native operating surface.
What It Supports
- Context architecture with rules:
.enclosure/rules/gives agents progressive, task-specific reading paths for ownership, boundaries, dependency direction, execution, testing, and refactoring. - Local architectural contract:
.enclosure/enclosure.yamldeclares roots, exclusions, tags, layer flow, dependency rules, file-shape rules, and report limits. - Boundary validation:
enclosure architecture boundarieschecks imports against configured ownership and layer rules. - Shape validation:
enclosure architecture shapechecks configured limits for files, symbols, imports, arguments, and line counts. - Architecture mapping:
enclosure architecture mapshows modules, layers, unknown files, dependencies, and hotspots. - Dependency pressure views:
enclosure architecture clustershighlights coupled areas before broad refactors. - Fast preflight:
enclosure healthgives an architect-friendly workspace and architecture overview before or after a task. - Project-shaped generation:
.enclosure/recipes/captures working module scaffolds found by the agent, then lets future tasks generate known-good files instead of hand-creating structure from scratch. - Assistant routing: generated
AGENTS.mdand.github/copilot-instructions.mdtell coding assistants to begin in.enclosure/. - Human-reviewable governance: the contract is plain YAML and Markdown, so teams can review it like code.
The Core Loop
1. Agent starts in .enclosure/
2. Agent reads the relevant rule path and architecture contract
3. Agent edits inside the declared ownership, seam, and layer flow
4. Agent runs the relevant enclosure checks
5. Violations reveal where the task jumped the fence
6. Agent steers back before review
That loop is the product. The CLI is intentionally small so the contract stays close to the repository and easy to change.
Install
pipx install enclosure
Try it without installing:
pipx run enclosure --help
enclosure supports Python 3.11+.
Quick Start
The simplest setup is to let a coding agent do the first pass.
Kickstarting Prompt
Copy this into your coding agent from the repository root:
Install or run enclosure if needed, then set up this repository for agentic coding.
Start by inspecting the existing project structure and identifying the main architectural roots, modules, layers, public seams, dependency direction, tests, and one or two working examples of a well-shaped module.
Run `enclosure workspace sync init`, then draft `.enclosure/enclosure.yaml` and local rules so future agents know where to start, what boundaries to respect, and how to verify their work.
If you find a repeatable module scaffold, turn it into an `.enclosure/recipes/` recipe so future agents generate that known-good structure instead of creating files manually.
Finish by running the relevant enclosure checks, report what the contract now covers, and call out anything that still needs human architectural judgment.
Or run the first commands yourself:
cd your-repo
enclosure workspace sync init
$EDITOR .enclosure/enclosure.yaml
enclosure health
enclosure architecture health
enclosure architecture boundaries
After setup, tell every coding agent:
Start in the .enclosure/ folder and stay anchored there while discovering project-specific operating guidance.
Contract Shape
The generated contract has four important surfaces:
.enclosure/
./enclosure.yaml # architecture roots, tags, flow, rules, limits
rules/ # shared and local guidance for agents
recipes/ # known-good scaffolds generated from working examples
AGENTS.md # assistant entry instruction
.github/
copilot-instructions.md
A typical architecture contract describes:
architecture:
root: src/enclosure/features
exclusions: [.venv/**, .enclosure/**, tests/**]
boundaries:
tags:
- { name: feature, match: "*" }
- { name: domain, match: "*/*/domain" }
- { name: application, match: "*/*/application" }
- { name: infrastructure, match: "*/*/infrastructure" }
- { name: ui, match: "*/*/ui" }
flow:
layers: [ui, application, infrastructure, domain]
analyzers: [backward-flow, no-cycles]
The full syntax is available in the generated .enclosure/enclosure.yaml and command docs.
Recipes are deliberately modest: they are not a framework. They are the reusable shape of code the repository already accepts. An agent can find a good module, convert that scaffold into a recipe, preview it with --dry-run, and then generate files that start inside the enclosure.
Useful Commands
enclosure --docs
enclosure --llm
enclosure health
enclosure workspace health
enclosure architecture health
enclosure architecture map
enclosure architecture boundaries
enclosure architecture shape
enclosure architecture clusters
enclosure workspace rules
enclosure workspace recipe --check
enclosure workspace recipe --list
enclosure workspace recipe <name> --show
enclosure workspace recipe <name> --dry-run
When To Use It
Use enclosure when:
- coding agents contribute to a repository with meaningful architectural boundaries;
- the team wants local rules to shape agent behavior before code review;
- module ownership, public seams, and dependency direction matter;
- generated code should follow project recipes;
- architects want a lightweight feedback loop instead of a new platform.
Skip it if the repository has no stable architecture yet or if you want a hosted workflow manager. enclosure is a repo-local contract and checker, not a platform.
Release Notes
See CHANGELOG.md.
Contributing
Ideas, issues, and pull requests are welcome.
Start with CONTRIBUTING.md.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file enclosure-1.0.6.tar.gz.
File metadata
- Download URL: enclosure-1.0.6.tar.gz
- Upload date:
- Size: 84.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f2f7565e55569f583b5b620211cb8d4202022112562889e392988d9960d606b
|
|
| MD5 |
ecdf9ed1591996bbdf941e0096d0e367
|
|
| BLAKE2b-256 |
2b784db9e5ec5493fcb21d80a2d857659e7a7b15e6c6c3c352abd2c2af47bd4c
|
Provenance
The following attestation bundles were made for enclosure-1.0.6.tar.gz:
Publisher:
release.yml on 9orky/enclosure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
enclosure-1.0.6.tar.gz -
Subject digest:
7f2f7565e55569f583b5b620211cb8d4202022112562889e392988d9960d606b - Sigstore transparency entry: 1662122358
- Sigstore integration time:
-
Permalink:
9orky/enclosure@2240ec54c76923a330cdd6ddd67e19f73fed2e70 -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/9orky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2240ec54c76923a330cdd6ddd67e19f73fed2e70 -
Trigger Event:
release
-
Statement type:
File details
Details for the file enclosure-1.0.6-py3-none-any.whl.
File metadata
- Download URL: enclosure-1.0.6-py3-none-any.whl
- Upload date:
- Size: 120.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d0ea2c0450ef1fe963d83cc622c9d41c6af4961d07d166283063c1006b452ad
|
|
| MD5 |
2da2b2e6f6ec9549da64a2c95fea5dbf
|
|
| BLAKE2b-256 |
ff78d0a0fdfcebe88aee74f6b42862a01488bdec10f3d28ee44ce399d528a0f4
|
Provenance
The following attestation bundles were made for enclosure-1.0.6-py3-none-any.whl:
Publisher:
release.yml on 9orky/enclosure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
enclosure-1.0.6-py3-none-any.whl -
Subject digest:
4d0ea2c0450ef1fe963d83cc622c9d41c6af4961d07d166283063c1006b452ad - Sigstore transparency entry: 1662122499
- Sigstore integration time:
-
Permalink:
9orky/enclosure@2240ec54c76923a330cdd6ddd67e19f73fed2e70 -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/9orky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2240ec54c76923a330cdd6ddd67e19f73fed2e70 -
Trigger Event:
release
-
Statement type: