Cross-agent token-efficiency layer for AI coding assistants (Claude Code, OpenAI Codex, GitHub Copilot).
Project description
🧱 Monolith
One ruleset. Every agent. Fewer tokens.
Reduce token usage across Claude Code, OpenAI Codex, and GitHub Copilot from one config. Monolith is a small, dependency-free CLI that writes proven token-saving rules into the native instructions file each AI coding agent already reads — so you author the rules once and every agent obeys them:
| Agent | File Monolith generates |
|---|---|
| Claude Code | CLAUDE.md |
| OpenAI Codex | AGENTS.md |
| GitHub Copilot | .github/copilot-instructions.md |
It also does task management (PRD → tracked tasks), ships a resource hub
of installable agent commands, and can shrink verbose tool output at
runtime — all from one tool.
⚡ Before / After
Without Monolith — 84 tokens
Great question! I'd be happy to help you figure this out. So, the reason your function is returning
Noneis actually because there's no explicit return statement at the end of the branch. What you'll want to do here is make sure you return the computed value. I hope this helps, and let me know if you have any other questions!
With Monolith — 19 tokens (−77%)
It returns
Nonebecause that branch has no return. Return the computed value.
Same answer. ~⅕ the tokens. (Measured by monolith bench.)
🪄 Why
Each agent reads instructions from a different file, so today you'd copy-paste the same rules into three places and keep them in sync by hand. Monolith keeps one canonical source and compiles it. Re-running is safe: managed content lives between markers and never clobbers your own notes in the same file.
It unifies what used to take several separate tools into one cross-agent CLI: token-saving rules, dense-output tiers, task management, a resource hub, and runtime command-output compression.
📦 Install
Requires Python ≥ 3.9. Dependency-free core.
pipx install monolith-ai # recommended (isolated)
# or
pip install monolith-ai
From source (current default until the first PyPI release is published):
git clone https://github.com/keyurpatel446/Monolith && cd Monolith
pip install -e . # or: pip install -e ".[bench]" for exact token counts
🚀 Quickstart
monolith init # detect agents, create .monolith/settings.json
monolith apply --agent all # write CLAUDE.md, AGENTS.md, copilot-instructions.md
monolith doctor # verify each agent picked up the rules
monolith tier ultra --apply # crank up compression
monolith bench # measure real token reduction on the sample corpus
🧰 What you get
Token efficiency
| Command | Description |
|---|---|
monolith init |
Detect agent files and create .monolith/settings.json. |
monolith apply [--agent all|claude|codex|copilot|config] |
Compile the directives into agent configs (idempotent). |
monolith tier [name] [--apply] |
Show or switch the active compression tier. |
monolith stats |
Show projected reduction, last measured reduction, and the input cost of the block. |
monolith bench |
Run the built-in benchmark corpus and record measured token reduction. |
monolith rules list|add|remove [value] |
Manage custom directives appended to every block. |
monolith doctor |
Verify each configured agent has the Monolith block. |
Task management
| Command | Description |
|---|---|
monolith plan <prd-file> [--force] |
Parse a PRD/Markdown file into a task tree; writes TASKS.md. |
monolith tasks [--emit] |
List the task tree; --emit re-writes TASKS.md. |
monolith task <id> --status todo|doing|done |
Update a task's status (warns on unmet dependencies). |
Resource hub & runtime
| Command | Description |
|---|---|
monolith hub list|search <q>|show <id>|install <id> [--agent] |
Browse and install curated agent resources. |
monolith shrink [file] [--level lite|full|ultra] |
Compress verbose output (stdin or file) deterministically. |
monolith run -- <command> |
Run a command, compress its output, save full output to disk on failure. |
monolith gain |
Show cumulative token savings from run. |
monolith mcp |
Run the experimental MCP server exposing shrink over stdio. |
monolith scan [--apply] |
Scan the repo for @monolith: task/rule tags and apply them. |
Global flag --root <dir> runs against another project directory.
🎚️ Tiers
| Tier | Intensity | Projected output reduction* |
|---|---|---|
lite |
filler removal only | ~25–35% |
full (default) |
filler + dense formatting + no over-engineering | ~55–65% |
ultra |
telegraphic, bullet-first, every directive | ~60–70% |
* Projections derived from upstream benchmarks, not per-project measurements.
Run monolith bench for a figure measured on the sample corpus.
See docs/CAPABILITIES.md for the full capability list.
🗂️ Task management
Point monolith plan at a PRD or any structured Markdown file. Headings and
list items become tasks; nesting becomes parent/child. Wire up dependencies
with inline tags — {#slug} names a task and @after:slug depends on it:
# Auth feature
- Design DB schema {#schema}
- Build API @after:schema
- Add input validation
## Release @after:schema
monolith plan prd.md writes a shared task store under .monolith/tasks/ and a
root TASKS.md your agents read as ordinary project context.
📚 Documentation
- Usage guide · Capabilities
- Per-agent setup: Claude Code · Codex · Copilot
- Roadmap · Changelog · Contributing
- Security · Publishing
- Analysis — benchmarks, competitor & stability analysis
- Demo: run
bash scripts/demo.sh(record with asciinema)
Keywords: reduce Claude Code token usage · Codex AGENTS.md token efficiency ·
GitHub Copilot instructions to save tokens · compress AI command/test output for
LLMs · cross-agent token optimization CLI · one config for Claude Code, Codex and
Copilot.
🌱 Development & branching
| Branch | Purpose |
|---|---|
master |
Default / release branch. Merges here trigger CI to tag a release. |
develop |
Integration branch for completed features. |
fetcher/<name> |
Feature work. |
fix/<name> |
Bug fixes. |
CI (.github/workflows/ci.yml) runs the test suite
on every push/PR to master and develop. When code is merged to master, it
reads the version from pyproject.toml and, if a matching tag does not yet
exist, creates the tag vX.Y.Z and a GitHub release. Bump version in
pyproject.toml to cut a new release.
python -m unittest discover -s tests -v # run the tests locally
☕ Support
Monolith is free and MIT-licensed. If it saves you tokens (and money), consider chipping in for a coffee — it genuinely helps keep the project moving. 🙏
📄 License
MIT © Keyur Patel
Project details
Release history Release notifications | RSS feed
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 monolith_ai-0.1.9.tar.gz.
File metadata
- Download URL: monolith_ai-0.1.9.tar.gz
- Upload date:
- Size: 67.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95b4a8f83a25515b9e78036d500caeb566139bfbf478eb5c97a042635f41f440
|
|
| MD5 |
ef1618c04022f1b72d09fcf8f1db8bc7
|
|
| BLAKE2b-256 |
9345f76766b981de5488a9905a66b6406d5f7b88f34ed6d74f229d2abdcb316c
|
Provenance
The following attestation bundles were made for monolith_ai-0.1.9.tar.gz:
Publisher:
ci.yml on keyurpatel446/Monolith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
monolith_ai-0.1.9.tar.gz -
Subject digest:
95b4a8f83a25515b9e78036d500caeb566139bfbf478eb5c97a042635f41f440 - Sigstore transparency entry: 1701973025
- Sigstore integration time:
-
Permalink:
keyurpatel446/Monolith@417de0df25d24530748a2333a04507715e9797ec -
Branch / Tag:
refs/heads/master - Owner: https://github.com/keyurpatel446
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@417de0df25d24530748a2333a04507715e9797ec -
Trigger Event:
push
-
Statement type:
File details
Details for the file monolith_ai-0.1.9-py3-none-any.whl.
File metadata
- Download URL: monolith_ai-0.1.9-py3-none-any.whl
- Upload date:
- Size: 44.8 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 |
9f63db7de123e506a94d5d587a6fb511512ad303e8fb81ab402380a74a146203
|
|
| MD5 |
0b97453607c5ba2aa8899302ba7f37f8
|
|
| BLAKE2b-256 |
ed8c1f357fbf36fa073a4f781b6758b8fdc46329a502dc7f90fa735daa24206a
|
Provenance
The following attestation bundles were made for monolith_ai-0.1.9-py3-none-any.whl:
Publisher:
ci.yml on keyurpatel446/Monolith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
monolith_ai-0.1.9-py3-none-any.whl -
Subject digest:
9f63db7de123e506a94d5d587a6fb511512ad303e8fb81ab402380a74a146203 - Sigstore transparency entry: 1701973102
- Sigstore integration time:
-
Permalink:
keyurpatel446/Monolith@417de0df25d24530748a2333a04507715e9797ec -
Branch / Tag:
refs/heads/master - Owner: https://github.com/keyurpatel446
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@417de0df25d24530748a2333a04507715e9797ec -
Trigger Event:
push
-
Statement type: