From fe0cd36a0978d774dae88f85d745778d815fd28b Mon Sep 17 00:00:00 2001 From: Naeha Date: Mon, 16 Nov 2026 18:41:50 +0530 Subject: [PATCH 1/2] ci: measure AGENTS.md and CLAUDE.md token growth per PR Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/ctxcap.yml | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/ctxcap.yml diff --git a/.github/workflows/ctxcap.yml b/.github/workflows/ctxcap.yml new file mode 100644 index 0000000000..de1f9e66ae --- /dev/null +++ b/.github/workflows/ctxcap.yml @@ -0,0 +1,38 @@ +name: context budget + +# AGENTS.md and CLAUDE.md are loaded by every harness working in this repo, so +# their token cost is part of the repo's interface. This measures the delta a PR +# introduces against the merge base and fails when it grows. +on: + pull_request: + branches: [main] + paths: + - 'AGENTS.md' + - 'CLAUDE.md' + - 'rust/AGENTS.md' + - 'rust/CLAUDE.md' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ctxcap-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + context-budget: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + fetch-depth: 0 + persist-credentials: false + - uses: Naeha-S/ctxcap@v1 + with: + fail-on: increase + stale: true From 1660f76cdc88ca97e37a2ee81200d740e23c1cf5 Mon Sep 17 00:00:00 2001 From: Naeha Date: Mon, 16 Nov 2026 18:55:05 +0530 Subject: [PATCH 2/2] ci: add nested context baseline for growth checks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .ctxcap.json | 3 +++ .github/workflows/ctxcap.yml | 14 +++++++++----- ctxcap-baseline.json | 13 +++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 .ctxcap.json create mode 100644 ctxcap-baseline.json diff --git a/.ctxcap.json b/.ctxcap.json new file mode 100644 index 0000000000..7a9b30d518 --- /dev/null +++ b/.ctxcap.json @@ -0,0 +1,3 @@ +{ + "include": ["AGENTS.md", "CLAUDE.md", "**/AGENTS.md", "**/CLAUDE.md"] +} diff --git a/.github/workflows/ctxcap.yml b/.github/workflows/ctxcap.yml index de1f9e66ae..4a25ccf0c2 100644 --- a/.github/workflows/ctxcap.yml +++ b/.github/workflows/ctxcap.yml @@ -2,15 +2,19 @@ name: context budget # AGENTS.md and CLAUDE.md are loaded by every harness working in this repo, so # their token cost is part of the repo's interface. This measures the delta a PR -# introduces against the merge base and fails when it grows. +# introduces against the merge base and fails when it grows. Nested per-crate +# AGENTS.md files are included, because a harness working in rust/crates/api is +# given that one and not the root file. The committed ctxcap-baseline.json is +# what the comparison uses; update it in the same PR as an intended increase. on: pull_request: branches: [main] paths: - - 'AGENTS.md' - - 'CLAUDE.md' - - 'rust/AGENTS.md' - - 'rust/CLAUDE.md' + - '**/AGENTS.md' # root, rust/, rust/crates/*/, and src/ + - '**/CLAUDE.md' + - '.ctxcap.json' # which files are in scope + - 'ctxcap-baseline.json' # what a PR is measured against + - '.github/workflows/ctxcap.yml' workflow_dispatch: permissions: diff --git a/ctxcap-baseline.json b/ctxcap-baseline.json new file mode 100644 index 0000000000..ae5dae31dd --- /dev/null +++ b/ctxcap-baseline.json @@ -0,0 +1,13 @@ +{ + "AGENTS.md": 1643, + "CLAUDE.md": 250, + "rust/AGENTS.md": 1005, + "rust/CLAUDE.md": 226, + "rust/crates/api/AGENTS.md": 762, + "rust/crates/commands/AGENTS.md": 819, + "rust/crates/plugins/AGENTS.md": 652, + "rust/crates/runtime/AGENTS.md": 983, + "rust/crates/rusty-claude-cli/AGENTS.md": 1034, + "rust/crates/tools/AGENTS.md": 836, + "src/AGENTS.md": 798 +}