ctxfire 0.1.0__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.
- ctxfire-0.1.0/.github/ISSUE_TEMPLATE/adapter.yml +28 -0
- ctxfire-0.1.0/.github/ISSUE_TEMPLATE/bug.yml +34 -0
- ctxfire-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- ctxfire-0.1.0/.github/dependabot.yml +10 -0
- ctxfire-0.1.0/.github/pull_request_template.md +14 -0
- ctxfire-0.1.0/.github/workflows/ci.yml +64 -0
- ctxfire-0.1.0/.github/workflows/publish-pypi.yml +43 -0
- ctxfire-0.1.0/.gitignore +10 -0
- ctxfire-0.1.0/AGENTS.md +95 -0
- ctxfire-0.1.0/CHANGELOG.md +17 -0
- ctxfire-0.1.0/CODE_OF_CONDUCT.md +14 -0
- ctxfire-0.1.0/CONTRIBUTING.md +16 -0
- ctxfire-0.1.0/LICENSE +21 -0
- ctxfire-0.1.0/PKG-INFO +268 -0
- ctxfire-0.1.0/README.md +233 -0
- ctxfire-0.1.0/SECURITY.md +25 -0
- ctxfire-0.1.0/ctxfire.example.toml +31 -0
- ctxfire-0.1.0/docs/ADAPTER_SPEC.md +138 -0
- ctxfire-0.1.0/docs/COMPETITORS.md +58 -0
- ctxfire-0.1.0/docs/DEMO.md +26 -0
- ctxfire-0.1.0/docs/DEPENDENCIES.md +26 -0
- ctxfire-0.1.0/docs/DISCOVERY.md +43 -0
- ctxfire-0.1.0/docs/EXTENDING.md +39 -0
- ctxfire-0.1.0/docs/FAQ.md +44 -0
- ctxfire-0.1.0/docs/PRICING.md +23 -0
- ctxfire-0.1.0/docs/PRIVACY.md +31 -0
- ctxfire-0.1.0/docs/PUBLIC_RELEASE_PLAN.md +144 -0
- ctxfire-0.1.0/docs/RELEASE_NOTES_v0.1.0.md +43 -0
- ctxfire-0.1.0/docs/REPORT_SCHEMA.md +61 -0
- ctxfire-0.1.0/docs/VALIDATION.md +71 -0
- ctxfire-0.1.0/docs/assets/social-preview.png +0 -0
- ctxfire-0.1.0/docs/assets/social-preview.svg +46 -0
- ctxfire-0.1.0/examples/demo/.agents/skills/release/SKILL.md +3 -0
- ctxfire-0.1.0/examples/demo/AGENTS.md +4 -0
- ctxfire-0.1.0/examples/demo/after.toml +16 -0
- ctxfire-0.1.0/examples/demo/before.toml +17 -0
- ctxfire-0.1.0/examples/demo/docs/legacy-handbook.md +8 -0
- ctxfire-0.1.0/llms.txt +18 -0
- ctxfire-0.1.0/pyproject.toml +70 -0
- ctxfire-0.1.0/schemas/report-v1.0.schema.json +102 -0
- ctxfire-0.1.0/scripts/validate_public_repos.py +100 -0
- ctxfire-0.1.0/scripts/validate_report_schema.py +26 -0
- ctxfire-0.1.0/src/ctxfire/__init__.py +3 -0
- ctxfire-0.1.0/src/ctxfire/__main__.py +5 -0
- ctxfire-0.1.0/src/ctxfire/adapters.py +185 -0
- ctxfire-0.1.0/src/ctxfire/cli.py +297 -0
- ctxfire-0.1.0/src/ctxfire/config.py +149 -0
- ctxfire-0.1.0/src/ctxfire/discovery.py +101 -0
- ctxfire-0.1.0/src/ctxfire/model.py +72 -0
- ctxfire-0.1.0/src/ctxfire/py.typed +1 -0
- ctxfire-0.1.0/src/ctxfire/render.py +152 -0
- ctxfire-0.1.0/src/ctxfire/scanner.py +174 -0
- ctxfire-0.1.0/tests/test_ctxfire.py +239 -0
- ctxfire-0.1.0/uv.lock +1236 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Adapter request or correction
|
|
2
|
+
description: Propose loading semantics backed by an official source
|
|
3
|
+
labels: [adapter]
|
|
4
|
+
body:
|
|
5
|
+
- type: input
|
|
6
|
+
id: engine
|
|
7
|
+
attributes:
|
|
8
|
+
label: Engine and version
|
|
9
|
+
validations:
|
|
10
|
+
required: true
|
|
11
|
+
- type: input
|
|
12
|
+
id: source
|
|
13
|
+
attributes:
|
|
14
|
+
label: Official documentation URL
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: semantics
|
|
19
|
+
attributes:
|
|
20
|
+
label: Loading rule and uncertainty
|
|
21
|
+
validations:
|
|
22
|
+
required: true
|
|
23
|
+
- type: textarea
|
|
24
|
+
id: fixture
|
|
25
|
+
attributes:
|
|
26
|
+
label: Minimal fixture layout
|
|
27
|
+
validations:
|
|
28
|
+
required: true
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Report a reproducible scanner, adapter, or output problem
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: Do not paste private repository paths or content. Redact reports first.
|
|
8
|
+
- type: input
|
|
9
|
+
id: version
|
|
10
|
+
attributes:
|
|
11
|
+
label: ctxfire version
|
|
12
|
+
placeholder: ctxfire 0.1.0
|
|
13
|
+
validations:
|
|
14
|
+
required: true
|
|
15
|
+
- type: textarea
|
|
16
|
+
id: reproduction
|
|
17
|
+
attributes:
|
|
18
|
+
label: Minimal reproduction
|
|
19
|
+
description: Include a small public fixture or synthetic file tree and config.
|
|
20
|
+
validations:
|
|
21
|
+
required: true
|
|
22
|
+
- type: textarea
|
|
23
|
+
id: expected
|
|
24
|
+
attributes:
|
|
25
|
+
label: Expected versus actual behavior
|
|
26
|
+
validations:
|
|
27
|
+
required: true
|
|
28
|
+
- type: dropdown
|
|
29
|
+
id: platform
|
|
30
|
+
attributes:
|
|
31
|
+
label: Platform
|
|
32
|
+
options: [Linux, macOS, Windows, Other]
|
|
33
|
+
validations:
|
|
34
|
+
required: true
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## What changed
|
|
2
|
+
|
|
3
|
+
## Contract impact
|
|
4
|
+
|
|
5
|
+
- [ ] Adapter semantics unchanged or versioned/documented
|
|
6
|
+
- [ ] Report schema unchanged or versioned/documented
|
|
7
|
+
- [ ] Default output remains metadata-only and repository-relative
|
|
8
|
+
|
|
9
|
+
## Validation
|
|
10
|
+
|
|
11
|
+
- [ ] `ruff check .`
|
|
12
|
+
- [ ] `mypy src`
|
|
13
|
+
- [ ] `pytest`
|
|
14
|
+
- [ ] `python -m build`
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
quality:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7
|
|
16
|
+
- uses: actions/setup-python@v7
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
cache: pip
|
|
20
|
+
- run: python -m pip install --upgrade pip
|
|
21
|
+
- run: python -m pip install -e '.[dev]'
|
|
22
|
+
- run: ruff check .
|
|
23
|
+
- run: mypy src
|
|
24
|
+
- run: pytest
|
|
25
|
+
- run: |
|
|
26
|
+
ctxfire scan --config examples/demo/before.toml --format json --output before.json
|
|
27
|
+
ctxfire scan --config examples/demo/after.toml --format json --output after.json
|
|
28
|
+
ctxfire diff before.json after.json
|
|
29
|
+
python scripts/validate_report_schema.py before.json
|
|
30
|
+
python scripts/validate_report_schema.py after.json
|
|
31
|
+
|
|
32
|
+
test:
|
|
33
|
+
strategy:
|
|
34
|
+
fail-fast: false
|
|
35
|
+
matrix:
|
|
36
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
37
|
+
python: ["3.11", "3.12", "3.13"]
|
|
38
|
+
runs-on: ${{ matrix.os }}
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v7
|
|
41
|
+
- uses: actions/setup-python@v7
|
|
42
|
+
with:
|
|
43
|
+
python-version: ${{ matrix.python }}
|
|
44
|
+
cache: pip
|
|
45
|
+
- run: python -m pip install --upgrade pip
|
|
46
|
+
- run: python -m pip install '.[tokenizers]'
|
|
47
|
+
- run: python -m unittest discover -s tests -v
|
|
48
|
+
- run: ctxfire --version
|
|
49
|
+
|
|
50
|
+
package:
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@v7
|
|
54
|
+
- uses: actions/setup-python@v7
|
|
55
|
+
with:
|
|
56
|
+
python-version: "3.12"
|
|
57
|
+
cache: pip
|
|
58
|
+
- run: python -m pip install --upgrade build twine
|
|
59
|
+
- run: python -m build
|
|
60
|
+
- run: python -m twine check dist/*
|
|
61
|
+
- uses: actions/upload-artifact@v7
|
|
62
|
+
with:
|
|
63
|
+
name: distributions
|
|
64
|
+
path: dist/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v7
|
|
15
|
+
with:
|
|
16
|
+
ref: ${{ github.event.release.tag_name }}
|
|
17
|
+
- uses: actions/setup-python@v7
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
- run: python -m pip install --upgrade build
|
|
21
|
+
- run: python -m build
|
|
22
|
+
- uses: actions/upload-artifact@v7
|
|
23
|
+
with:
|
|
24
|
+
name: pypi-distributions
|
|
25
|
+
path: dist/
|
|
26
|
+
|
|
27
|
+
publish:
|
|
28
|
+
if: ${{ vars.PYPI_PUBLISH == 'true' }}
|
|
29
|
+
needs: build
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
environment:
|
|
32
|
+
name: pypi
|
|
33
|
+
url: https://pypi.org/project/ctxfire/
|
|
34
|
+
permissions:
|
|
35
|
+
id-token: write
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/download-artifact@v8
|
|
38
|
+
with:
|
|
39
|
+
name: pypi-distributions
|
|
40
|
+
path: dist/
|
|
41
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
42
|
+
with:
|
|
43
|
+
attestations: true
|
ctxfire-0.1.0/.gitignore
ADDED
ctxfire-0.1.0/AGENTS.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# ctxfire — Agent Bootstrap
|
|
2
|
+
|
|
3
|
+
Last updated: 2026-08-29. Repository status: **v0.1.0 initial public release**.
|
|
4
|
+
|
|
5
|
+
Read this file first, followed by `README.md`, `ctxfire.example.toml`, the
|
|
6
|
+
source, and `docs/PUBLIC_RELEASE_PLAN.md`.
|
|
7
|
+
|
|
8
|
+
## Product in one sentence
|
|
9
|
+
|
|
10
|
+
`ctxfire` maps the context each versioned adapter attributes to a coding agent,
|
|
11
|
+
how often that agent fires, and the estimated token and API-equivalent cost per
|
|
12
|
+
fire and per day.
|
|
13
|
+
|
|
14
|
+
## Positioning
|
|
15
|
+
|
|
16
|
+
This is a static cost analyzer for multi-agent context graphs. It is not a live
|
|
17
|
+
token meter, agent package manager, skill recommender, generic context manager,
|
|
18
|
+
or exact subscription bill calculator.
|
|
19
|
+
|
|
20
|
+
The product's useful graph is:
|
|
21
|
+
|
|
22
|
+
`agent -> definition -> rules/skills/memory -> schedule -> estimated daily cost`
|
|
23
|
+
|
|
24
|
+
File paths and byte counts can be exact. Token counts, cache behaviour, prices,
|
|
25
|
+
and daily cost are estimates and must always expose their assumptions.
|
|
26
|
+
|
|
27
|
+
## Current state
|
|
28
|
+
|
|
29
|
+
- Version `0.1.0`; renamed from the colliding private draft name before launch.
|
|
30
|
+
- Versioned explicit, AGENTS.md, Codex, and Claude Code adapters.
|
|
31
|
+
- Git-index discovery plus narrow exact probes for ignored engine instructions.
|
|
32
|
+
- `scan`, `explain`, `diff`, and `check`; human, JSON 1.0, and SARIF 2.1.0.
|
|
33
|
+
- Dependency-free byte estimates and an opt-in local tiktoken backend.
|
|
34
|
+
- MIT license, community/security docs, CI, release workflow, fixtures, schema,
|
|
35
|
+
demo, and a dated 18-repository validation report.
|
|
36
|
+
|
|
37
|
+
## Non-negotiable boundaries
|
|
38
|
+
|
|
39
|
+
- Never present estimates as actual vendor bills or measured prompt-cache hits.
|
|
40
|
+
- Reports must separate exact facts from estimates and include model,
|
|
41
|
+
tokenizer, price date, cache assumption, and adapter version.
|
|
42
|
+
- Do not collect or upload repository contents. The OSS scanner is local-only
|
|
43
|
+
and telemetry-free by default.
|
|
44
|
+
- Do not absorb package management or runtime orchestration into this tool.
|
|
45
|
+
- Keep adapters explicit and versioned because engine loading semantics change.
|
|
46
|
+
- Use git-index and ignore semantics so worktrees, caches, generated copies, and
|
|
47
|
+
vendored trees do not silently inflate results.
|
|
48
|
+
- Keep the extraction clean-room: no internal hosts, agent names, schedules,
|
|
49
|
+
budgets, customer data, or private fleet topology.
|
|
50
|
+
|
|
51
|
+
## Next work, in order
|
|
52
|
+
|
|
53
|
+
1. Keep adapter semantics aligned with their dated official sources.
|
|
54
|
+
2. Preserve report schema 1.0 compatibility through the 0.1 line.
|
|
55
|
+
3. Triage real user reports before expanding engine or tokenizer scope.
|
|
56
|
+
4. Treat runtime measurement, package management, and scheduling as out of scope.
|
|
57
|
+
|
|
58
|
+
## v0.1 definition of done
|
|
59
|
+
|
|
60
|
+
- Loading rules are documented and pinned per adapter version.
|
|
61
|
+
- Discovery agrees with each supported engine on representative fixtures.
|
|
62
|
+
- Exact bytes, estimated tokens, schedules, cache assumptions, and prices are
|
|
63
|
+
distinguishable in both human and machine-readable reports.
|
|
64
|
+
- `explain` shows why every file is included; `diff` attributes cost changes;
|
|
65
|
+
`check` provides stable CI thresholds.
|
|
66
|
+
- The scanner handles ignored files, nested worktrees, symlinks, missing files,
|
|
67
|
+
cycles, shared dependencies, and generated content deterministically.
|
|
68
|
+
- Results are manually checked on 10–20 third-party repositories before launch.
|
|
69
|
+
- Clean installs, documentation, community files, security policy, changelog,
|
|
70
|
+
packaging, release workflow, and public demo are ready.
|
|
71
|
+
|
|
72
|
+
## Working rules for future agents
|
|
73
|
+
|
|
74
|
+
- Use Python 3.11+ and type all public interfaces.
|
|
75
|
+
- Treat adapter semantics and report schemas as public APIs.
|
|
76
|
+
- Add a regression fixture for every loading rule or parser quirk.
|
|
77
|
+
- Avoid reading file contents when metadata is enough; never print sensitive
|
|
78
|
+
contents in default reports.
|
|
79
|
+
- No hidden network calls or telemetry.
|
|
80
|
+
- Date and source every price or competitor claim.
|
|
81
|
+
- Before each release, repeat direct checks of GitHub, PyPI/npm, and competitor sites;
|
|
82
|
+
young tools and bot-blocked sites are easy to miss in search indexes.
|
|
83
|
+
|
|
84
|
+
## Success criterion
|
|
85
|
+
|
|
86
|
+
Before announcement: correct scans on 10–20 external repositories. Within 30
|
|
87
|
+
days after launch: at least three external users run it repeatedly or keep its
|
|
88
|
+
CI integration. Use voluntary adopter notes or interviews, not embedded
|
|
89
|
+
telemetry.
|
|
90
|
+
|
|
91
|
+
## Release authority
|
|
92
|
+
|
|
93
|
+
Agents may prepare and rehearse everything. Repository visibility changes,
|
|
94
|
+
package publication, public releases, directory submissions, and public launch
|
|
95
|
+
posts require explicit owner authorization in the active session.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes follow [Keep a Changelog](https://keepachangelog.com/) and
|
|
4
|
+
this project uses [Semantic Versioning](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
## [0.1.0] - 2026-08-29
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- Versioned `explicit@1`, `agents-md@1`, `codex@1`, and `claude-code@1` adapters.
|
|
11
|
+
- Git-index discovery with standard ignores and safe symlink/submodule handling.
|
|
12
|
+
- `scan`, `explain`, `diff`, and `check` commands.
|
|
13
|
+
- Human, JSON schema 1.0, and SARIF 2.1.0 output.
|
|
14
|
+
- Explicit token, schedule, conditional-activation, cache, price, and model assumptions.
|
|
15
|
+
- Reproducible fixtures, external-repository validation, packaging, and CI.
|
|
16
|
+
|
|
17
|
+
[0.1.0]: https://github.com/korovin-aa97/ctxfire/releases/tag/v0.1.0
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
We pledge to make participation in this project welcoming and harassment-free,
|
|
4
|
+
regardless of background, identity, experience, or viewpoint.
|
|
5
|
+
|
|
6
|
+
Be respectful, assume good intent, criticize ideas rather than people, and do
|
|
7
|
+
not publish another person's private information. Maintainers may edit, remove,
|
|
8
|
+
or reject contributions and comments that violate these expectations.
|
|
9
|
+
|
|
10
|
+
Report conduct concerns privately to the repository owner through the contact
|
|
11
|
+
method on their GitHub profile. Reports will be reviewed promptly and kept as
|
|
12
|
+
confidential as practical.
|
|
13
|
+
|
|
14
|
+
This compact policy is inspired by the Contributor Covenant 2.1.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thank you for helping make agent context costs explainable.
|
|
4
|
+
|
|
5
|
+
1. Open an issue for a loading-semantics change before implementing it.
|
|
6
|
+
2. Keep runtime code dependency-free unless a dependency has a clear accuracy
|
|
7
|
+
or security benefit.
|
|
8
|
+
3. Add a regression fixture for every adapter/discovery quirk.
|
|
9
|
+
4. Keep reports metadata-only and repository-relative by default.
|
|
10
|
+
5. Run `ruff check .`, `mypy src`, `pytest`, and `python -m build`.
|
|
11
|
+
|
|
12
|
+
Adapters and report schemas are public APIs. A changed engine behavior needs an
|
|
13
|
+
official source link, an uncertainty note, and either a compatible adapter
|
|
14
|
+
patch or a new adapter version. Do not silently change existing semantics.
|
|
15
|
+
|
|
16
|
+
By participating you agree to the [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md).
|
ctxfire-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alexander Korovin
|
|
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.
|
ctxfire-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ctxfire
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Explain and budget static context graphs for coding agents
|
|
5
|
+
Project-URL: Homepage, https://github.com/korovin-aa97/ctxfire
|
|
6
|
+
Project-URL: Documentation, https://github.com/korovin-aa97/ctxfire#readme
|
|
7
|
+
Project-URL: Issues, https://github.com/korovin-aa97/ctxfire/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/korovin-aa97/ctxfire/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Alexander Korovin
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: ai-agents,claude-code,codex,context-window,static-analysis
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: build<2,>=1.2; extra == 'dev'
|
|
26
|
+
Requires-Dist: jsonschema<5,>=4.23; extra == 'dev'
|
|
27
|
+
Requires-Dist: mypy<2,>=1.11; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest<10,>=9.0.3; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff<1,>=0.6; extra == 'dev'
|
|
30
|
+
Requires-Dist: tiktoken<1,>=0.7; extra == 'dev'
|
|
31
|
+
Requires-Dist: twine<7,>=6; extra == 'dev'
|
|
32
|
+
Provides-Extra: tokenizers
|
|
33
|
+
Requires-Dist: tiktoken<1,>=0.7; extra == 'tokenizers'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# ctxfire
|
|
37
|
+
|
|
38
|
+
**See what every coding agent loads, why it loads, and what that repeated
|
|
39
|
+
context could cost.**
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
`ctxfire` is a local, telemetry-free static analyzer for multi-agent context
|
|
44
|
+
graphs. It connects agent definitions to repository instructions, rules, and
|
|
45
|
+
skills; multiplies the estimated input by each agent's schedule; and keeps every
|
|
46
|
+
assumption visible.
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
implementer [codex@1]
|
|
50
|
+
context candidates: 3 files, 18120 exact bytes/fire
|
|
51
|
+
estimate: 3810 tokens/fire × 8/day = 30480 tokens/day
|
|
52
|
+
reviewer [claude-code@1]
|
|
53
|
+
context candidates: 4 files, 22644 exact bytes/fire
|
|
54
|
+
estimate: 4725 tokens/fire × 8/day = 37800 tokens/day
|
|
55
|
+
|
|
56
|
+
TOTAL estimated tokens/day: 68280
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This is not a runtime meter or an invoice calculator. File sizes are exact;
|
|
60
|
+
tokens, conditional activation, cache behavior, schedules, and API-equivalent
|
|
61
|
+
prices are estimates recorded in every report.
|
|
62
|
+
|
|
63
|
+
## Why another context-cost tool?
|
|
64
|
+
|
|
65
|
+
Most repository analyzers ask, “How large is this codebase?” Runtime meters ask,
|
|
66
|
+
“What did this one session consume?” `ctxfire` asks a different question:
|
|
67
|
+
|
|
68
|
+
> What is the transitive instruction surface of each agent, and what happens
|
|
69
|
+
> when the team loads it repeatedly every day?
|
|
70
|
+
|
|
71
|
+
The unit of analysis is `agent → loading rule → context file → schedule`, not a
|
|
72
|
+
flat repository walk.
|
|
73
|
+
|
|
74
|
+
## Quickstart
|
|
75
|
+
|
|
76
|
+
Python 3.11+ and Git are the only requirements.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pipx install git+https://github.com/korovin-aa97/ctxfire.git@v0.1.0
|
|
80
|
+
ctxfire --version
|
|
81
|
+
cp ctxfire.example.toml ctxfire.toml
|
|
82
|
+
ctxfire scan
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Or run without a persistent install:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
uvx --from git+https://github.com/korovin-aa97/ctxfire.git@v0.1.0 ctxfire scan
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Start from [`ctxfire.example.toml`](ctxfire.example.toml):
|
|
92
|
+
|
|
93
|
+
```toml
|
|
94
|
+
schema_version = "1"
|
|
95
|
+
|
|
96
|
+
[project]
|
|
97
|
+
name = "my-agent-team"
|
|
98
|
+
root = "."
|
|
99
|
+
bytes_per_token = 4.0
|
|
100
|
+
tokenizer = "byte-estimate"
|
|
101
|
+
model = "unspecified"
|
|
102
|
+
price_date = "unspecified"
|
|
103
|
+
cache_assumption = "no-cache-credit"
|
|
104
|
+
conditional_activation_rate = 0.25
|
|
105
|
+
|
|
106
|
+
[[agents]]
|
|
107
|
+
name = "implementer"
|
|
108
|
+
adapter = "codex@1"
|
|
109
|
+
working_directory = "."
|
|
110
|
+
fires_per_day = 8
|
|
111
|
+
include = ["docs/product-rules.md"]
|
|
112
|
+
conditional = ["docs/playbooks/**/*.md"]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`usd_per_million_input_tokens` is optional. Add it only with a model and a
|
|
116
|
+
dated price you have verified. `ctxfire` deliberately ships no silently aging
|
|
117
|
+
vendor price table.
|
|
118
|
+
|
|
119
|
+
## Commands
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Human report
|
|
123
|
+
ctxfire scan --config ctxfire.toml
|
|
124
|
+
|
|
125
|
+
# Stable schema 1.0 snapshot
|
|
126
|
+
ctxfire scan --format json --output before.json
|
|
127
|
+
|
|
128
|
+
# Why is each edge present?
|
|
129
|
+
ctxfire explain --agent implementer
|
|
130
|
+
ctxfire explain --file AGENTS.md
|
|
131
|
+
|
|
132
|
+
# Attribute change between snapshots
|
|
133
|
+
ctxfire diff before.json after.json
|
|
134
|
+
|
|
135
|
+
# CI: exit 2 only when a budget is exceeded
|
|
136
|
+
ctxfire check --max-tokens-per-day 75000
|
|
137
|
+
|
|
138
|
+
# GitHub-compatible SARIF
|
|
139
|
+
ctxfire check --max-tokens-per-day 75000 --format sarif --output ctxfire.sarif
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Exit codes are stable: `0` success/pass, `1` invalid input or operational error,
|
|
143
|
+
and `2` a valid scan that exceeded a `check` budget.
|
|
144
|
+
|
|
145
|
+
## Exact versus estimated
|
|
146
|
+
|
|
147
|
+
| Field | Kind | Meaning |
|
|
148
|
+
|---|---|---|
|
|
149
|
+
| relative path, file presence, byte size | Exact | Facts from the local working tree |
|
|
150
|
+
| adapter and inclusion reason | Declared model | Versioned loading semantics used for the graph |
|
|
151
|
+
| tokens | Estimated | `ceil(bytes / bytes_per_token)` by default, or an opt-in local tokenizer count |
|
|
152
|
+
| conditional activation | Estimated | User-provided rate from 0 to 1 |
|
|
153
|
+
| fires/day | Assumption | Planning input; `ctxfire` is not a scheduler |
|
|
154
|
+
| USD/day | Estimated equivalence | Dated input-token price × estimated tokens; not a bill |
|
|
155
|
+
| cache | Assumption | Stated in the report; v0.1 does not observe cache hits |
|
|
156
|
+
|
|
157
|
+
The default estimator never reads file contents. This makes it reproducible and
|
|
158
|
+
privacy-safe, but less accurate than a model-specific tokenizer—especially for
|
|
159
|
+
non-English text and code-heavy files.
|
|
160
|
+
|
|
161
|
+
For an opt-in local tokenizer:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
pipx install 'ctxfire[tokenizers]'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Then set `tokenizer = "tiktoken:cl100k_base"` (or another explicit tiktoken
|
|
168
|
+
encoding). The report records the installed tokenizer version and changes
|
|
169
|
+
`discovery.content_access` to `matched-file-content-local`. Matched bytes are
|
|
170
|
+
read only in memory; they are never printed, stored, or uploaded.
|
|
171
|
+
|
|
172
|
+
## Supported adapters
|
|
173
|
+
|
|
174
|
+
| Adapter | Always-on context | Conditional candidates |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `explicit@1` | `include` patterns | `conditional` patterns |
|
|
177
|
+
| `agents-md@1` | ancestor `AGENTS.md` chain for `working_directory` | configured patterns |
|
|
178
|
+
| `codex@1` | precedence-selected ancestor instruction chain, under a declared byte cap | ancestor `.agents/skills/*/SKILL.md` bodies |
|
|
179
|
+
| `claude-code@1` | ancestor project memory and conservative project rules | descendant memory and project skill bodies |
|
|
180
|
+
|
|
181
|
+
Adapters are conservative static models, not claims that every candidate is
|
|
182
|
+
loaded on every invocation. Details, source links, and known uncertainty are in
|
|
183
|
+
[`docs/ADAPTER_SPEC.md`](docs/ADAPTER_SPEC.md).
|
|
184
|
+
|
|
185
|
+
## Git-aware and private by default
|
|
186
|
+
|
|
187
|
+
- Uses `git ls-files --cached --others --exclude-standard` at a Git top-level.
|
|
188
|
+
- Includes tracked files and non-ignored untracked files; ignored build output
|
|
189
|
+
does not silently inflate the graph.
|
|
190
|
+
- Probes only known exact engine instruction paths and exact configured paths
|
|
191
|
+
outside that universe, so an ignored `CLAUDE.local.md` is still counted and
|
|
192
|
+
clearly warned without opening arbitrary ignored trees.
|
|
193
|
+
- Skips symlinks rather than following them outside the repository.
|
|
194
|
+
- Skips submodule gitlinks and missing/non-regular paths with a warning.
|
|
195
|
+
- Emits repository-relative paths, never an absolute workstation path.
|
|
196
|
+
- Default byte mode reads file metadata only. The optional tokenizer reads only
|
|
197
|
+
matched files locally; neither mode makes network calls, emits telemetry,
|
|
198
|
+
uploads content, or invokes a model.
|
|
199
|
+
|
|
200
|
+
For non-Git directories, a clearly reported conservative filesystem fallback is
|
|
201
|
+
used. See [`docs/PRIVACY.md`](docs/PRIVACY.md) and
|
|
202
|
+
[`docs/DISCOVERY.md`](docs/DISCOVERY.md).
|
|
203
|
+
|
|
204
|
+
## CI example
|
|
205
|
+
|
|
206
|
+
```yaml
|
|
207
|
+
- name: Enforce agent context budget
|
|
208
|
+
run: |
|
|
209
|
+
pipx install git+https://github.com/korovin-aa97/ctxfire.git@v0.1.0
|
|
210
|
+
ctxfire check --max-tokens-per-day 75000 \
|
|
211
|
+
--format sarif --output ctxfire.sarif
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Pin a release tag or commit in CI. `ctxfire diff` also lets reviewers see
|
|
215
|
+
whether a context-cost increase came from a new file, a removed file, or a size
|
|
216
|
+
change.
|
|
217
|
+
|
|
218
|
+
## Current limitations
|
|
219
|
+
|
|
220
|
+
- The default byte-ratio estimator is intentionally approximate. The optional
|
|
221
|
+
tiktoken backend is more repeatable for a named encoding but still does not
|
|
222
|
+
prove which tokenizer a hosted agent runtime used.
|
|
223
|
+
- Claude rule frontmatter is not parsed by the v0.1 adapter. Rules are counted
|
|
224
|
+
as always-on by default; set `claude_rules_activation =
|
|
225
|
+
"conditional"` only when that is a justified project-wide approximation.
|
|
226
|
+
- User-level/global engine instructions are outside the project root and are
|
|
227
|
+
intentionally not scanned.
|
|
228
|
+
- Imports referenced inside Markdown are not inferred. Add them explicitly.
|
|
229
|
+
- Submodule contents and symlink targets are not traversed.
|
|
230
|
+
- Subscription quotas, tool output, conversation history, cached-token billing,
|
|
231
|
+
output tokens, and runtime prompt construction are outside scope.
|
|
232
|
+
|
|
233
|
+
## Development
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
python -m venv .venv
|
|
237
|
+
. .venv/bin/activate
|
|
238
|
+
python -m pip install -e '.[dev]'
|
|
239
|
+
ruff check .
|
|
240
|
+
mypy src
|
|
241
|
+
pytest
|
|
242
|
+
python -m build
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The report contract is public API. Schema changes require a new schema version,
|
|
246
|
+
fixture updates, and a changelog entry.
|
|
247
|
+
|
|
248
|
+
See the [deterministic before/after demo](docs/DEMO.md) for a small, inspectable
|
|
249
|
+
`diff` walkthrough.
|
|
250
|
+
|
|
251
|
+
Questions about bills, privacy, shared files, rules, symlinks, or prices are
|
|
252
|
+
answered in the [FAQ](docs/FAQ.md).
|
|
253
|
+
|
|
254
|
+
The default package has no runtime dependencies; the optional tokenizer stack
|
|
255
|
+
and its licenses are recorded in the [dependency review](docs/DEPENDENCIES.md).
|
|
256
|
+
|
|
257
|
+
## Project status
|
|
258
|
+
|
|
259
|
+
`v0.1.0` is an intentionally small first release. It was exercised against 18
|
|
260
|
+
unrelated public repositories; the dated methodology and results live in
|
|
261
|
+
[`docs/VALIDATION.md`](docs/VALIDATION.md). Contributions are welcome—see
|
|
262
|
+
[`CONTRIBUTING.md`](CONTRIBUTING.md) and the extension guide.
|
|
263
|
+
|
|
264
|
+
Built from operating a mixed Claude/Codex production fleet. The analyzer is a
|
|
265
|
+
clean, generic extraction: no private fleet configuration or telemetry is
|
|
266
|
+
included.
|
|
267
|
+
|
|
268
|
+
MIT © 2026 Alexander Korovin.
|