monolith-ai 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. monolith_ai-0.1.9/.github/FUNDING.yml +4 -0
  2. monolith_ai-0.1.9/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
  3. monolith_ai-0.1.9/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. monolith_ai-0.1.9/.github/ISSUE_TEMPLATE/feature_request.md +18 -0
  5. monolith_ai-0.1.9/.github/PULL_REQUEST_TEMPLATE.md +17 -0
  6. monolith_ai-0.1.9/.github/copilot-instructions.md +22 -0
  7. monolith_ai-0.1.9/.github/workflows/ci.yml +82 -0
  8. monolith_ai-0.1.9/.gitignore +25 -0
  9. monolith_ai-0.1.9/.monolith/settings.json +9 -0
  10. monolith_ai-0.1.9/AGENTS.md +22 -0
  11. monolith_ai-0.1.9/CHANGELOG.md +129 -0
  12. monolith_ai-0.1.9/CLAUDE.md +22 -0
  13. monolith_ai-0.1.9/CONTRIBUTING.md +42 -0
  14. monolith_ai-0.1.9/LICENSE +21 -0
  15. monolith_ai-0.1.9/PKG-INFO +211 -0
  16. monolith_ai-0.1.9/README.md +194 -0
  17. monolith_ai-0.1.9/ROADMAP.md +116 -0
  18. monolith_ai-0.1.9/SECURITY.md +49 -0
  19. monolith_ai-0.1.9/docs/ABOUT.md +40 -0
  20. monolith_ai-0.1.9/docs/CAPABILITIES.md +30 -0
  21. monolith_ai-0.1.9/docs/PUBLISHING.md +55 -0
  22. monolith_ai-0.1.9/docs/USAGE.md +220 -0
  23. monolith_ai-0.1.9/docs/agents/claude-code.md +65 -0
  24. monolith_ai-0.1.9/docs/agents/codex.md +30 -0
  25. monolith_ai-0.1.9/docs/agents/copilot.md +34 -0
  26. monolith_ai-0.1.9/docs/analysis/README.md +15 -0
  27. monolith_ai-0.1.9/docs/analysis/benchmarks.md +49 -0
  28. monolith_ai-0.1.9/docs/analysis/competitors.md +48 -0
  29. monolith_ai-0.1.9/docs/analysis/discoverability.md +81 -0
  30. monolith_ai-0.1.9/docs/analysis/stability.md +44 -0
  31. monolith_ai-0.1.9/docs/launch/README.md +20 -0
  32. monolith_ai-0.1.9/docs/launch/awesome-claude-code.md +50 -0
  33. monolith_ai-0.1.9/docs/launch/blog.md +82 -0
  34. monolith_ai-0.1.9/docs/launch/reddit.md +34 -0
  35. monolith_ai-0.1.9/docs/launch/show-hn.md +33 -0
  36. monolith_ai-0.1.9/docs/launch/social.md +54 -0
  37. monolith_ai-0.1.9/pyproject.toml +35 -0
  38. monolith_ai-0.1.9/scripts/demo.sh +30 -0
  39. monolith_ai-0.1.9/src/monolith/__init__.py +16 -0
  40. monolith_ai-0.1.9/src/monolith/__main__.py +6 -0
  41. monolith_ai-0.1.9/src/monolith/adapters/__init__.py +43 -0
  42. monolith_ai-0.1.9/src/monolith/adapters/claude_code.py +19 -0
  43. monolith_ai-0.1.9/src/monolith/adapters/compiler.py +154 -0
  44. monolith_ai-0.1.9/src/monolith/adapters/github_copilot.py +22 -0
  45. monolith_ai-0.1.9/src/monolith/adapters/openai_codex.py +19 -0
  46. monolith_ai-0.1.9/src/monolith/benchmark.py +190 -0
  47. monolith_ai-0.1.9/src/monolith/compression.py +103 -0
  48. monolith_ai-0.1.9/src/monolith/compressors.py +237 -0
  49. monolith_ai-0.1.9/src/monolith/console.py +668 -0
  50. monolith_ai-0.1.9/src/monolith/directives.py +97 -0
  51. monolith_ai-0.1.9/src/monolith/hub.py +164 -0
  52. monolith_ai-0.1.9/src/monolith/mcp_server.py +126 -0
  53. monolith_ai-0.1.9/src/monolith/runner.py +127 -0
  54. monolith_ai-0.1.9/src/monolith/scan.py +157 -0
  55. monolith_ai-0.1.9/src/monolith/settings.py +76 -0
  56. monolith_ai-0.1.9/src/monolith/shrink.py +120 -0
  57. monolith_ai-0.1.9/src/monolith/tasks.py +262 -0
  58. monolith_ai-0.1.9/src/monolith/tokens.py +69 -0
  59. monolith_ai-0.1.9/tests/test_benchmark.py +41 -0
  60. monolith_ai-0.1.9/tests/test_compiler.py +64 -0
  61. monolith_ai-0.1.9/tests/test_compressors.py +152 -0
  62. monolith_ai-0.1.9/tests/test_console.py +185 -0
  63. monolith_ai-0.1.9/tests/test_hub.py +50 -0
  64. monolith_ai-0.1.9/tests/test_pipe.py +34 -0
  65. monolith_ai-0.1.9/tests/test_runner.py +48 -0
  66. monolith_ai-0.1.9/tests/test_scan.py +77 -0
  67. monolith_ai-0.1.9/tests/test_shrink.py +65 -0
  68. monolith_ai-0.1.9/tests/test_tasks.py +103 -0
@@ -0,0 +1,4 @@
1
+ # Configures the "Sponsor" button shown at the top of the GitHub repo.
2
+ # PayPal has no native key, so it is exposed via the `custom` URL list.
3
+ custom:
4
+ - https://paypal.me/keyurpatel446
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Bug report
3
+ about: Something isn't working as expected
4
+ title: "[bug] "
5
+ labels: bug
6
+ ---
7
+
8
+ **What happened**
9
+ A clear, concise description of the bug.
10
+
11
+ **To reproduce**
12
+ Exact commands, e.g.:
13
+ ```bash
14
+ monolith apply --agent all
15
+ ```
16
+
17
+ **Expected behaviour**
18
+ What you expected instead.
19
+
20
+ **Environment**
21
+ - Monolith version (`monolith --version`):
22
+ - Python version (`python --version`):
23
+ - OS:
24
+ - Agent(s) affected (Claude Code / Codex / Copilot):
25
+
26
+ **Additional context**
27
+ Logs, generated file snippets, or anything else useful.
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Question or idea
4
+ url: https://github.com/keyurpatel446/Monolith/discussions
5
+ about: Ask questions or share ideas in Discussions.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea or improvement
4
+ title: "[feat] "
5
+ labels: enhancement
6
+ ---
7
+
8
+ **Problem**
9
+ What are you trying to do that Monolith doesn't support today?
10
+
11
+ **Proposed solution**
12
+ What you'd like to happen (a command, a flag, an agent, etc.).
13
+
14
+ **Alternatives considered**
15
+ Any workarounds or other approaches.
16
+
17
+ **Scope check**
18
+ Does this keep the core dependency-free and the numbers honest? Any trade-offs?
@@ -0,0 +1,17 @@
1
+ ## Summary
2
+ What does this change and why?
3
+
4
+ ## Type
5
+ - [ ] Feature (`fetcher/<name>`)
6
+ - [ ] Fix (`fix/<name>`)
7
+ - [ ] Docs / chore
8
+
9
+ ## Checklist
10
+ - [ ] Targets `develop` (not `master`).
11
+ - [ ] Tests added/updated; `python -m unittest discover -s tests` passes.
12
+ - [ ] No new runtime dependencies (or justified below).
13
+ - [ ] Numbers stay honest (projected vs measured labelled).
14
+ - [ ] `CHANGELOG.md` updated if user-facing.
15
+
16
+ ## Notes
17
+ Anything reviewers should know.
@@ -0,0 +1,22 @@
1
+ <!-- monolith:start -->
2
+ <!-- Generated by Monolith. Do not edit between the markers; run `monolith apply` to regenerate. -->
3
+ ## Token-Efficiency Rules (Monolith - tier: full)
4
+
5
+ GitHub Copilot: apply these custom instructions to keep responses concise and low-token across this repository.
6
+
7
+ _Answer directly and densely. Use the fewest tokens that fully convey the answer._
8
+
9
+ - Do not open with greetings, acknowledgements, or filler such as "Sure!", "Great question!", or "Certainly".
10
+ - Do not end with pleasantries or offers of further help such as "I hope this helps!" or "Let me know if you need anything else."
11
+ - Do not restate or paraphrase the request before answering.
12
+ - Correct mistakes in one short sentence; do not apologize repeatedly.
13
+ - Lead with the answer or the result; put caveats and context after, and only if they matter.
14
+ - Do not append a summary of what you just did unless explicitly asked.
15
+ - Prefer dense formats โ€” tables, lists, and code blocks โ€” over prose when they convey the same information in fewer tokens.
16
+ - Do not narrate or re-explain code you just wrote unless asked; let the code and concise comments speak.
17
+ - Write only comments that add non-obvious information; skip comments that merely restate the code.
18
+ - Implement what was asked. Do not add speculative abstractions, options, or defensive code that was not requested.
19
+ - Do not agree reflexively. If something is wrong or a better option exists, say so plainly and briefly.
20
+
21
+ > User instructions in the conversation always override these rules.
22
+ <!-- monolith:end -->
@@ -0,0 +1,82 @@
1
+ name: CI
2
+
3
+ # Tests run on every push/PR to master or develop. When code lands on master
4
+ # (i.e. a merge), the `release` job reads the version from pyproject.toml and, if
5
+ # no matching tag exists yet, creates the tag + GitHub release AND publishes to
6
+ # PyPI. Publishing lives in this job (not a separate tag-triggered workflow)
7
+ # because a tag pushed with GITHUB_TOKEN does not trigger other workflows.
8
+ on:
9
+ push:
10
+ branches: [master, develop]
11
+ pull_request:
12
+ branches: [master, develop]
13
+
14
+ jobs:
15
+ test:
16
+ name: Test (py${{ matrix.python-version }})
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ python-version: ["3.9", "3.11", "3.12"]
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: ${{ matrix.python-version }}
28
+ - name: Install package
29
+ run: pip install -e .
30
+ - name: Run tests
31
+ run: python -m unittest discover -s tests -v
32
+
33
+ release:
34
+ name: Tag, release & publish on merge to master
35
+ runs-on: ubuntu-latest
36
+ needs: test
37
+ # Only on a real push (merge) to master, never on PRs or develop.
38
+ if: github.event_name == 'push' && github.ref == 'refs/heads/master'
39
+ environment: pypi # matches the PyPI Trusted Publisher config
40
+ permissions:
41
+ contents: write # push the tag + create the release
42
+ id-token: write # PyPI Trusted Publishing (OIDC)
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+ with:
46
+ fetch-depth: 0 # full history so we can see existing tags
47
+ - name: Read version from pyproject.toml
48
+ id: ver
49
+ run: |
50
+ VERSION=$(grep -m1 '^version' pyproject.toml | sed -E 's/.*"([^"]+)".*/\1/')
51
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
52
+ echo "Detected version: $VERSION"
53
+ - name: Create tag + release if missing
54
+ id: tag
55
+ env:
56
+ GH_TOKEN: ${{ github.token }}
57
+ run: |
58
+ TAG="v${{ steps.ver.outputs.version }}"
59
+ if git rev-parse "$TAG" >/dev/null 2>&1; then
60
+ echo "Tag $TAG already exists; skipping release/publish."
61
+ echo "created=false" >> "$GITHUB_OUTPUT"
62
+ exit 0
63
+ fi
64
+ git config user.name "github-actions[bot]"
65
+ git config user.email "github-actions[bot]@users.noreply.github.com"
66
+ git tag -a "$TAG" -m "Release $TAG"
67
+ git push origin "$TAG"
68
+ gh release create "$TAG" --title "$TAG" --generate-notes
69
+ echo "created=true" >> "$GITHUB_OUTPUT"
70
+ - name: Set up Python
71
+ if: steps.tag.outputs.created == 'true'
72
+ uses: actions/setup-python@v5
73
+ with:
74
+ python-version: "3.11"
75
+ - name: Build distributions
76
+ if: steps.tag.outputs.created == 'true'
77
+ run: |
78
+ python -m pip install --upgrade build
79
+ python -m build
80
+ - name: Publish to PyPI (Trusted Publishing)
81
+ if: steps.tag.outputs.created == 'true'
82
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,25 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+ env/
11
+
12
+ # Test / coverage
13
+ .pytest_cache/
14
+ .coverage
15
+ htmlcov/
16
+
17
+ # Editors / OS
18
+ .idea/
19
+ .vscode/
20
+ .DS_Store
21
+
22
+ # Monolith local state (generated per-project, not committed in consumer repos)
23
+ .monolith/stats.json
24
+ .monolith/gain.json
25
+ .monolith/tee/
@@ -0,0 +1,9 @@
1
+ {
2
+ "tier": "full",
3
+ "agents": [
4
+ "claude",
5
+ "codex",
6
+ "copilot"
7
+ ],
8
+ "extra_rules": []
9
+ }
@@ -0,0 +1,22 @@
1
+ <!-- monolith:start -->
2
+ <!-- Generated by Monolith. Do not edit between the markers; run `monolith apply` to regenerate. -->
3
+ ## Token-Efficiency Rules (Monolith - tier: full)
4
+
5
+ Codex agent: follow these token-efficiency rules for all output in this repository unless instructed otherwise.
6
+
7
+ _Answer directly and densely. Use the fewest tokens that fully convey the answer._
8
+
9
+ - Do not open with greetings, acknowledgements, or filler such as "Sure!", "Great question!", or "Certainly".
10
+ - Do not end with pleasantries or offers of further help such as "I hope this helps!" or "Let me know if you need anything else."
11
+ - Do not restate or paraphrase the request before answering.
12
+ - Correct mistakes in one short sentence; do not apologize repeatedly.
13
+ - Lead with the answer or the result; put caveats and context after, and only if they matter.
14
+ - Do not append a summary of what you just did unless explicitly asked.
15
+ - Prefer dense formats โ€” tables, lists, and code blocks โ€” over prose when they convey the same information in fewer tokens.
16
+ - Do not narrate or re-explain code you just wrote unless asked; let the code and concise comments speak.
17
+ - Write only comments that add non-obvious information; skip comments that merely restate the code.
18
+ - Implement what was asked. Do not add speculative abstractions, options, or defensive code that was not requested.
19
+ - Do not agree reflexively. If something is wrong or a better option exists, say so plainly and briefly.
20
+
21
+ > User instructions in the conversation always override these rules.
22
+ <!-- monolith:end -->
@@ -0,0 +1,129 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/), and this project adheres to
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.9] - 2026-06-02
10
+
11
+ ### Fixed
12
+ - **Packaging**: use PEP 639 SPDX license metadata (`license = "MIT"` +
13
+ `license-files`); the built sdist/wheel now pass `twine check` and are valid
14
+ for PyPI.
15
+ - **Publishing actually triggers**: moved PyPI publish into the `release` job of
16
+ `ci.yml`. A tag pushed by `GITHUB_TOKEN` does not trigger separate workflows,
17
+ so the old `publish.yml` never ran; publishing now happens in the job that
18
+ creates the tag. Removed `publish.yml`.
19
+
20
+ ## [0.1.8] - 2026-06-01
21
+
22
+ ### Changed
23
+ - Lint compressor now compacts diagnostics โ€” keeps location + level + rule,
24
+ drops the verbose human message and repeated file paths. Measured ~49โ€“55%
25
+ reduction (was ~1%); full detail still tee'd on failure.
26
+ - Removed "inspired by" attributions from the docs and code comments.
27
+
28
+ ## [0.1.7] - 2026-06-01
29
+
30
+ ### Added
31
+ - More command-aware compressors for `run`: linters/type-checkers
32
+ (eslint/tsc/ruff/flake8/pylint/mypy/biome/stylelint), `git status` (drops the
33
+ "(use โ€ฆ)" hint chatter), and grep/find (group matches by file, paths by
34
+ directory; never expands).
35
+
36
+ ## [0.1.6] - 2026-06-01
37
+
38
+ ### Added
39
+ - `monolith run -- <command>` (`runner.py`): runs a command, prints its
40
+ compressed output, propagates the exit code, and saves full output to
41
+ `.monolith/tee/` on failure.
42
+ - Command-aware compression (`compressors.py`): `run` recognises test commands
43
+ (pytest/jest/vitest/go test/cargo test/unittest/npm test) and keeps only
44
+ failures + the summary (~90% reduction on large runs), falling back to generic
45
+ `shrink` for unrecognised commands.
46
+ - `monolith gain`: cumulative token-savings ledger across `run` invocations.
47
+
48
+ ## [0.1.5] - 2026-06-01
49
+
50
+ ### Added
51
+ - `SECURITY.md` (disclosure policy + security model and considerations).
52
+ - `docs/PUBLISHING.md`; PyPI publish workflow switched to Trusted Publishing
53
+ (OIDC) โ€” no stored API token.
54
+ - More hub resources: `test-plan`, `tighten-prose`, `explain-diff`.
55
+ - v0.2.0 plan in `ROADMAP.md`.
56
+
57
+ ## [0.1.4] - 2026-06-01
58
+
59
+ ### Fixed
60
+ - CLI no longer prints a `BrokenPipeError` traceback when its output is piped
61
+ into a consumer that closes early (e.g. `monolith shrink โ€ฆ | head`). (The fix
62
+ missed the v0.1.3 tag due to a merge-ordering race; this release carries it.)
63
+
64
+ ## [0.1.3] - 2026-06-01
65
+
66
+ ### Added
67
+ - `monolith scan [--apply]`: scan the repo for inline `@monolith:task` and
68
+ `@monolith:rule` tags and fold them into the task store / custom rules.
69
+ - `docs/CAPABILITIES.md` (Capability ร— Monolith table) and `docs/ABOUT.md`
70
+ (suggested GitHub About / topics).
71
+ - Claude Code guide: install steps, installing hub commands as slash commands,
72
+ and adding the `shrink` MCP server.
73
+
74
+ ### Removed
75
+ - `monolith compare` command and the README competitor-comparison section.
76
+ Monolith is now presented on its own capabilities; honest projected-vs-measured
77
+ framing is kept.
78
+
79
+ ## [0.1.2] - 2026-06-01
80
+
81
+ ### Fixed
82
+ - `--version` now reads from installed package metadata (single-sourced), fixing
83
+ a drift where it reported the previous version.
84
+
85
+ ### Added
86
+ - Monolith now manages its own repository (dogfooding): generated `CLAUDE.md`,
87
+ `AGENTS.md`, and `.github/copilot-instructions.md`.
88
+
89
+ ## [0.1.1] - 2026-06-01
90
+
91
+ ### Added
92
+ - PyPI publish workflow (`.github/workflows/publish.yml`) triggered on `v*` tags.
93
+ - Contributor docs: `CONTRIBUTING.md`, issue/PR templates, and a demo script
94
+ (`scripts/demo.sh`).
95
+ - Launch copy pack under `docs/launch/`.
96
+
97
+ ### Changed
98
+ - README install now leads with `pipx`/`pip` and links the changelog,
99
+ contributing guide, and demo.
100
+
101
+ ## [0.1.0] - 2026-06-01
102
+
103
+ ### Added
104
+ - **Cross-agent token efficiency**: one directive set compiled into `CLAUDE.md`,
105
+ `AGENTS.md`, and `.github/copilot-instructions.md`, with `lite`/`full`/`ultra`
106
+ compression tiers. Commands: `init`, `apply`, `tier`, `doctor`.
107
+ - **Measurement**: `bench` (real reduction on a sample corpus), `stats`
108
+ (projected + measured), and `compare` (provenance-tagged vs caveman /
109
+ token-efficient). Optional `tiktoken` extra for exact counts.
110
+ - **Custom rules**: `rules list/add/remove`.
111
+ - **Task management**: `plan` (PRD/Markdown โ†’ task tree), `tasks`, and `task`
112
+ with `{#slug}` / `@after:` dependencies and a generated `TASKS.md`.
113
+ - **Resource hub**: `hub list/search/show/install` of curated agent assets.
114
+ - **Runtime compression**: `shrink` (deterministic) and an experimental MCP
115
+ server (`mcp`).
116
+ - CI with test matrix (Python 3.9/3.11/3.12) and auto-tagging on merge to
117
+ `master`.
118
+
119
+ [Unreleased]: https://github.com/keyurpatel446/Monolith/compare/v0.1.9...HEAD
120
+ [0.1.9]: https://github.com/keyurpatel446/Monolith/compare/v0.1.8...v0.1.9
121
+ [0.1.8]: https://github.com/keyurpatel446/Monolith/compare/v0.1.7...v0.1.8
122
+ [0.1.7]: https://github.com/keyurpatel446/Monolith/compare/v0.1.6...v0.1.7
123
+ [0.1.6]: https://github.com/keyurpatel446/Monolith/compare/v0.1.5...v0.1.6
124
+ [0.1.5]: https://github.com/keyurpatel446/Monolith/compare/v0.1.4...v0.1.5
125
+ [0.1.4]: https://github.com/keyurpatel446/Monolith/compare/v0.1.3...v0.1.4
126
+ [0.1.3]: https://github.com/keyurpatel446/Monolith/compare/v0.1.2...v0.1.3
127
+ [0.1.2]: https://github.com/keyurpatel446/Monolith/compare/v0.1.1...v0.1.2
128
+ [0.1.1]: https://github.com/keyurpatel446/Monolith/compare/v0.1.0...v0.1.1
129
+ [0.1.0]: https://github.com/keyurpatel446/Monolith/releases/tag/v0.1.0
@@ -0,0 +1,22 @@
1
+ <!-- monolith:start -->
2
+ <!-- Generated by Monolith. Do not edit between the markers; run `monolith apply` to regenerate. -->
3
+ ## Token-Efficiency Rules (Monolith - tier: full)
4
+
5
+ Claude Code: these project rules reduce token usage. Honour them in every response unless the user says otherwise.
6
+
7
+ _Answer directly and densely. Use the fewest tokens that fully convey the answer._
8
+
9
+ - Do not open with greetings, acknowledgements, or filler such as "Sure!", "Great question!", or "Certainly".
10
+ - Do not end with pleasantries or offers of further help such as "I hope this helps!" or "Let me know if you need anything else."
11
+ - Do not restate or paraphrase the request before answering.
12
+ - Correct mistakes in one short sentence; do not apologize repeatedly.
13
+ - Lead with the answer or the result; put caveats and context after, and only if they matter.
14
+ - Do not append a summary of what you just did unless explicitly asked.
15
+ - Prefer dense formats โ€” tables, lists, and code blocks โ€” over prose when they convey the same information in fewer tokens.
16
+ - Do not narrate or re-explain code you just wrote unless asked; let the code and concise comments speak.
17
+ - Write only comments that add non-obvious information; skip comments that merely restate the code.
18
+ - Implement what was asked. Do not add speculative abstractions, options, or defensive code that was not requested.
19
+ - Do not agree reflexively. If something is wrong or a better option exists, say so plainly and briefly.
20
+
21
+ > User instructions in the conversation always override these rules.
22
+ <!-- monolith:end -->
@@ -0,0 +1,42 @@
1
+ # Contributing to Monolith
2
+
3
+ Thanks for your interest! Monolith aims to stay small, honest, and dependency-free.
4
+
5
+ ## Development setup
6
+
7
+ ```bash
8
+ git clone https://github.com/keyurpatel446/Monolith
9
+ cd Monolith
10
+ pip install -e . # or: pip install -e ".[bench]" for exact token counts
11
+ python -m unittest discover -s tests -v
12
+ ```
13
+
14
+ The core is **stdlib-only** by design; please don't add runtime dependencies
15
+ without discussion (`tiktoken` is an optional `[bench]` extra).
16
+
17
+ ## Branching model
18
+
19
+ | Branch | Purpose |
20
+ |--------|---------|
21
+ | `master` | Default / release branch (merges trigger a tagged release). |
22
+ | `develop` | Integration branch. |
23
+ | `fetcher/<name>` | Feature work. |
24
+ | `fix/<name>` | Bug fixes. |
25
+
26
+ Open PRs against `develop`. Releases flow `develop โ†’ master`.
27
+
28
+ ## Guidelines
29
+
30
+ - **Tests**: add/extend `unittest` tests under `tests/` for any behaviour change.
31
+ - **Comments**: match the surrounding style โ€” module/function docstrings and
32
+ rationale for non-obvious logic.
33
+ - **Honesty**: keep projected vs measured numbers clearly labelled; never
34
+ overstate reductions.
35
+ - **Adding an agent**: subclass `Compiler` in `src/monolith/adapters/`, set
36
+ `key`/`label`/`target_path`, override `preamble()`, decorate with `@register`,
37
+ and add it to the import list in `adapters/__init__.py`.
38
+
39
+ ## Releasing
40
+
41
+ Bump `version` in `pyproject.toml`, update `CHANGELOG.md`, and merge to `master`.
42
+ CI tags `vX.Y.Z`, creates a GitHub release, and publishes to PyPI.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Keyur Patel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: monolith-ai
3
+ Version: 0.1.9
4
+ Summary: Cross-agent token-efficiency layer for AI coding assistants (Claude Code, OpenAI Codex, GitHub Copilot).
5
+ Project-URL: Homepage, https://github.com/keyurpatel446/monolith
6
+ Project-URL: Roadmap, https://github.com/keyurpatel446/monolith/blob/main/ROADMAP.md
7
+ Author-email: Keyur Patel <keyurpatel446@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai-agents,claude-code,cli,codex,copilot,llm,tokens
11
+ Classifier: Environment :: Console
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.9
14
+ Provides-Extra: bench
15
+ Requires-Dist: tiktoken>=0.5; extra == 'bench'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # ๐Ÿงฑ Monolith
19
+
20
+ > **One ruleset. Every agent. Fewer tokens.**
21
+
22
+ [![CI](https://github.com/keyurpatel446/Monolith/actions/workflows/ci.yml/badge.svg)](https://github.com/keyurpatel446/Monolith/actions/workflows/ci.yml)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
24
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](pyproject.toml)
25
+ [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#-development--branching)
26
+ [![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-PayPal-00457C?logo=paypal&logoColor=white)](https://paypal.me/keyurpatel446)
27
+
28
+ **Reduce token usage across Claude Code, OpenAI Codex, and GitHub Copilot from one
29
+ config.** Monolith is a small, dependency-free CLI that writes proven token-saving
30
+ rules into the native instructions file each AI coding agent already reads โ€” so
31
+ you author the rules **once** and every agent obeys them:
32
+
33
+ | Agent | File Monolith generates |
34
+ |-------|-------------------------|
35
+ | Claude Code | `CLAUDE.md` |
36
+ | OpenAI Codex | `AGENTS.md` |
37
+ | GitHub Copilot | `.github/copilot-instructions.md` |
38
+
39
+ It also does **task management** (PRD โ†’ tracked tasks), ships a **resource hub**
40
+ of installable agent commands, and can **`shrink`** verbose tool output at
41
+ runtime โ€” all from one tool.
42
+
43
+ ---
44
+
45
+ ## โšก Before / After
46
+
47
+ **Without Monolith** โ€” _84 tokens_
48
+ > Great question! I'd be happy to help you figure this out. So, the reason your
49
+ > function is returning `None` is actually because there's no explicit return
50
+ > statement at the end of the branch. What you'll want to do here is make sure
51
+ > you return the computed value. I hope this helps, and let me know if you have
52
+ > any other questions!
53
+
54
+ **With Monolith** โ€” _19 tokens (โˆ’77%)_
55
+ > It returns `None` because that branch has no return. Return the computed value.
56
+
57
+ Same answer. ~โ…• the tokens. (Measured by `monolith bench`.)
58
+
59
+ ---
60
+
61
+ ## ๐Ÿช„ Why
62
+
63
+ Each agent reads instructions from a different file, so today you'd copy-paste
64
+ the same rules into three places and keep them in sync by hand. Monolith keeps
65
+ one canonical source and compiles it. Re-running is safe: managed content lives
66
+ between markers and never clobbers your own notes in the same file.
67
+
68
+ It unifies what used to take several separate tools into one cross-agent CLI:
69
+ token-saving rules, dense-output tiers, task management, a resource hub, and
70
+ runtime command-output compression.
71
+
72
+ ## ๐Ÿ“ฆ Install
73
+
74
+ Requires Python โ‰ฅ 3.9. Dependency-free core.
75
+
76
+ ```bash
77
+ pipx install monolith-ai # recommended (isolated)
78
+ # or
79
+ pip install monolith-ai
80
+ ```
81
+
82
+ From source (current default until the first PyPI release is published):
83
+
84
+ ```bash
85
+ git clone https://github.com/keyurpatel446/Monolith && cd Monolith
86
+ pip install -e . # or: pip install -e ".[bench]" for exact token counts
87
+ ```
88
+
89
+ ## ๐Ÿš€ Quickstart
90
+
91
+ ```bash
92
+ monolith init # detect agents, create .monolith/settings.json
93
+ monolith apply --agent all # write CLAUDE.md, AGENTS.md, copilot-instructions.md
94
+ monolith doctor # verify each agent picked up the rules
95
+ monolith tier ultra --apply # crank up compression
96
+ monolith bench # measure real token reduction on the sample corpus
97
+ ```
98
+
99
+ ## ๐Ÿงฐ What you get
100
+
101
+ **Token efficiency**
102
+
103
+ | Command | Description |
104
+ |---------|-------------|
105
+ | `monolith init` | Detect agent files and create `.monolith/settings.json`. |
106
+ | `monolith apply [--agent all\|claude\|codex\|copilot\|config]` | Compile the directives into agent configs (idempotent). |
107
+ | `monolith tier [name] [--apply]` | Show or switch the active compression tier. |
108
+ | `monolith stats` | Show projected reduction, last measured reduction, and the input cost of the block. |
109
+ | `monolith bench` | Run the built-in benchmark corpus and record measured token reduction. |
110
+ | `monolith rules list\|add\|remove [value]` | Manage custom directives appended to every block. |
111
+ | `monolith doctor` | Verify each configured agent has the Monolith block. |
112
+
113
+ **Task management**
114
+
115
+ | Command | Description |
116
+ |---------|-------------|
117
+ | `monolith plan <prd-file> [--force]` | Parse a PRD/Markdown file into a task tree; writes `TASKS.md`. |
118
+ | `monolith tasks [--emit]` | List the task tree; `--emit` re-writes `TASKS.md`. |
119
+ | `monolith task <id> --status todo\|doing\|done` | Update a task's status (warns on unmet dependencies). |
120
+
121
+ **Resource hub & runtime**
122
+
123
+ | Command | Description |
124
+ |---------|-------------|
125
+ | `monolith hub list\|search <q>\|show <id>\|install <id> [--agent]` | Browse and install curated agent resources. |
126
+ | `monolith shrink [file] [--level lite\|full\|ultra]` | Compress verbose output (stdin or file) deterministically. |
127
+ | `monolith run -- <command>` | Run a command, compress its output, save full output to disk on failure. |
128
+ | `monolith gain` | Show cumulative token savings from `run`. |
129
+ | `monolith mcp` | Run the experimental MCP server exposing `shrink` over stdio. |
130
+ | `monolith scan [--apply]` | Scan the repo for `@monolith:` task/rule tags and apply them. |
131
+
132
+ Global flag `--root <dir>` runs against another project directory.
133
+
134
+ ## ๐ŸŽš๏ธ Tiers
135
+
136
+ | Tier | Intensity | Projected output reduction* |
137
+ |------|-----------|-----------------------------|
138
+ | `lite` | filler removal only | ~25โ€“35% |
139
+ | `full` (default) | filler + dense formatting + no over-engineering | ~55โ€“65% |
140
+ | `ultra` | telegraphic, bullet-first, every directive | ~60โ€“70% |
141
+
142
+ \* Projections derived from upstream benchmarks, not per-project measurements.
143
+ Run `monolith bench` for a figure measured on the sample corpus.
144
+
145
+ See [docs/CAPABILITIES.md](docs/CAPABILITIES.md) for the full capability list.
146
+
147
+ ## ๐Ÿ—‚๏ธ Task management
148
+
149
+ Point `monolith plan` at a PRD or any structured Markdown file. Headings and
150
+ list items become tasks; nesting becomes parent/child. Wire up dependencies
151
+ with inline tags โ€” `{#slug}` names a task and `@after:slug` depends on it:
152
+
153
+ ```markdown
154
+ # Auth feature
155
+ - Design DB schema {#schema}
156
+ - Build API @after:schema
157
+ - Add input validation
158
+ ## Release @after:schema
159
+ ```
160
+
161
+ `monolith plan prd.md` writes a shared task store under `.monolith/tasks/` and a
162
+ root `TASKS.md` your agents read as ordinary project context.
163
+
164
+ ## ๐Ÿ“š Documentation
165
+
166
+ - [Usage guide](docs/USAGE.md) ยท [Capabilities](docs/CAPABILITIES.md)
167
+ - Per-agent setup: [Claude Code](docs/agents/claude-code.md) ยท
168
+ [Codex](docs/agents/codex.md) ยท [Copilot](docs/agents/copilot.md)
169
+ - [Roadmap](ROADMAP.md) ยท [Changelog](CHANGELOG.md) ยท [Contributing](CONTRIBUTING.md)
170
+ - [Security](SECURITY.md) ยท [Publishing](docs/PUBLISHING.md)
171
+ - [Analysis](docs/analysis/) โ€” benchmarks, competitor & stability analysis
172
+ - Demo: run `bash scripts/demo.sh` (record with asciinema)
173
+
174
+ ---
175
+
176
+ <sub>Keywords: reduce Claude Code token usage ยท Codex `AGENTS.md` token efficiency ยท
177
+ GitHub Copilot instructions to save tokens ยท compress AI command/test output for
178
+ LLMs ยท cross-agent token optimization CLI ยท one config for Claude Code, Codex and
179
+ Copilot.</sub>
180
+
181
+ ## ๐ŸŒฑ Development & branching
182
+
183
+ | Branch | Purpose |
184
+ |--------|---------|
185
+ | `master` | Default / release branch. Merges here trigger CI to tag a release. |
186
+ | `develop` | Integration branch for completed features. |
187
+ | `fetcher/<name>` | Feature work. |
188
+ | `fix/<name>` | Bug fixes. |
189
+
190
+ CI ([`.github/workflows/ci.yml`](.github/workflows/ci.yml)) runs the test suite
191
+ on every push/PR to `master` and `develop`. When code is merged to `master`, it
192
+ reads the version from `pyproject.toml` and, if a matching tag does not yet
193
+ exist, creates the tag `vX.Y.Z` and a GitHub release. Bump `version` in
194
+ `pyproject.toml` to cut a new release.
195
+
196
+ ```bash
197
+ python -m unittest discover -s tests -v # run the tests locally
198
+ ```
199
+
200
+ ## โ˜• Support
201
+
202
+ Monolith is free and MIT-licensed. If it saves you tokens (and money), consider
203
+ chipping in for a coffee โ€” it genuinely helps keep the project moving. ๐Ÿ™
204
+
205
+ [![Buy me a coffee via PayPal](https://img.shields.io/badge/โ˜•%20Buy%20me%20a%20coffee-PayPal-00457C?logo=paypal&logoColor=white&style=for-the-badge)](https://paypal.me/keyurpatel446)
206
+
207
+ > ๐Ÿ‘‰ **[paypal.me/keyurpatel446](https://paypal.me/keyurpatel446)**
208
+
209
+ ## ๐Ÿ“„ License
210
+
211
+ MIT ยฉ Keyur Patel