Repository navigation
docs(skills): streamline agent guidance and enforce commit scopes - #1555
Conversation
A subject line cannot reveal an invented scope on its own: `feat(coding)` reads fine until you know the change was codex. Add a commit-msg hook that reads the ownership off the staged paths instead and rejects a scope that points elsewhere, or is missing when the change belongs to one adapter. Only `rust/adapters/*` maps to a scope. Replaying the rules over the last 400 commits showed that deriving one from the crates rejects good messages, because those crates are catch-alls whose commits are scoped by feature (`cost`, `statusline`, `json`) rather than by crate name. With adapters alone the replay produces no false rejection, while `perf(rust)` and `chore(deps)` stay available for workspace-wide and cross-cutting changes.
A squash merge writes the pull request title as the subject that lands on main, so the commit-msg hook never sees it. Check the title against the same adapter ownership rules, reading the changed files from the API so the job needs no checkout. The rules are inline rather than a call into scripts/validate-commit-scope.nu: running that script would mean cloning the repository and installing Nix for a title check. The two copies are cross-referenced so they move together.
An outside contributor's PR title is now rejected by CI when its scope names something other than the adapter it changes, so the rule belongs where they read before opening one.
AGENTS.md loads before an agent knows what it is doing, so it should carry only what is true at that point: where code lives, which skill owns what, and the policies an agent would otherwise violate unknowingly. Everything else was a second copy of a skill that loads on trigger anyway. Move the task-time detail into the owning skills, drop what one `ls` or `just --list` reveals, and name real files where the guidance pointed at a description of them. The root file goes from 140 to 55 lines.
Rewrite every skill under .agents/skills for current frontier models, following the prompt-reduction work Anthropic describes and the context engineering guidance that came out of it, both now linked from skill-creator. Three edits repeated across the set. Prohibitions and "always" rules that restate good practice become the repo fact plus the judgement the fact implies, because a "do not" collides badly with a user instruction and the model already applies the practice. Examples the model can derive are gone; what remains is the shape that cannot be guessed. Paraphrases of code become pointers to the file that shows it, so the skill cannot drift from what it describes. Eleven reference files merged into the skill that linked them, or into the skill that already owned the topic. The set drops from 2250 to 1103 lines with no repo-specific fact lost: paths, just recipes, crate and adapter names, fixtures, and validation steps were checked against the tree, and the ones an earlier pass over-cut were restored.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | 717d77b | Commit Preview URL Branch Preview URL |
Aug 01 2026, 11:17 AM |
📝 WalkthroughWalkthroughThe pull request reorganizes repository and agent-skill guidance around the Rust adapter architecture. It updates development, testing, profiling, and workflow instructions. It also adds adapter-aware Conventional Commit scope validation to Git hooks and pull-request CI. ChangesRepository and adapter guidance
Source and runtime guidance
Engineering and skill guidance
Commit and pull-request workflow
Commit and pull-request scope enforcement
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant Developer
participant CommitHook
participant ScopeValidator
participant AdapterPaths
participant PRWorkflow
Developer->>CommitHook: create commit
CommitHook->>ScopeValidator: validate subject and staged paths
ScopeValidator->>AdapterPaths: derive adapter owners
AdapterPaths-->>ScopeValidator: return owners
ScopeValidator-->>CommitHook: accept or reject scope
Developer->>PRWorkflow: open pull request
PRWorkflow->>AdapterPaths: retrieve changed files
PRWorkflow-->>Developer: report title-scope result
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Diagnosis: The Fix: Changed the bare URL back to a proper markdown link Push blocked: Task list (5/5 completed)
|
tirith reads "do not reveal" as a prompt-injection pattern and fails the scan at error level, so the phrase cannot stay in a skill file.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Skills condensed — every skill under
.agents/skillsrewritten following the linked context-engineering guidance: prohibitions and always-rules replaced by repo facts plus the judgment they imply, derivable examples removed, code paraphrases replaced by file pointers. Six reference files fully deleted and merged into parent skills; many more trimmed. No repo-specific facts lost — paths,justrecipes, crate names, fixture locations, and validation steps were traced against the tree. - AGENTS.md reduced — from 67 to 55 lines, keeping only routing, repository shape, and the policies an agent would violate unknowingly. Content that was load-time-duplicated between
AGENTS.mdand a skill moved to the skill. - Commit scope enforcement — new
scripts/validate-commit-scope.nucommit-msg hook derives the owner fromrust/adapters/<agent>/staged paths and rejects a scope that names something else or is missing when the change is single-agent. Cross-cutting and workspace scopes accepted;rust/adapters/common/maps toadapter. A matching CI job checks PR titles viagh apiso the squash-merge subject onmainpasses the same rules. - Hook wiring — new
ccusage-commit-scopeentry innix/git-hooks.nix,commit-msgstage, priority 0. - CONTRIBUTING.md — new "Commit and PR Titles" section documenting the convention for human contributors.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — one new commit since the initial review.
f217edae— rewords "Two boundaries the crate names do not reveal" to "Two boundaries the crate names hide" in.agents/skills/rust/SKILL.md. No behavioral impact.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
ccusage
@ccusage/ccusage-darwin-arm64
@ccusage/ccusage-darwin-x64
@ccusage/ccusage-linux-arm64
@ccusage/ccusage-linux-x64
@ccusage/ccusage-win32-x64
commit: |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/check-pr-title.yaml">
<violation number="1" location=".github/workflows/check-pr-title.yaml:51">
P3: Scope enforcement is implemented twice, so the local commit hook and CI can silently diverge whenever a scope or path-mapping rule changes. Running the repository script from CI (with a checkout), or extracting shared logic that both callers execute, would leave one source of truth.</violation>
</file>
Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.
Re-trigger cubic
| # This job only calls GitHub APIs, so keeping the script inline avoids a repository clone. | ||
| run: | | ||
| # Mirrors scripts/validate-commit-scope.nu; the two move together. | ||
| const CROSS_CUTTING_SCOPES = [deps, release, pricing, revert] |
There was a problem hiding this comment.
P3: Scope enforcement is implemented twice, so the local commit hook and CI can silently diverge whenever a scope or path-mapping rule changes. Running the repository script from CI (with a checkout), or extracting shared logic that both callers execute, would leave one source of truth.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/check-pr-title.yaml, line 51:
<comment>Scope enforcement is implemented twice, so the local commit hook and CI can silently diverge whenever a scope or path-mapping rule changes. Running the repository script from CI (with a checkout), or extracting shared logic that both callers execute, would leave one source of truth.</comment>
<file context>
@@ -23,3 +23,100 @@ jobs:
+ # This job only calls GitHub APIs, so keeping the script inline avoids a repository clone.
+ run: |
+ # Mirrors scripts/validate-commit-scope.nu; the two move together.
+ const CROSS_CUTTING_SCOPES = [deps, release, pricing, revert]
+ const WORKSPACE_SCOPES = [adapter, all, rust]
+ const GENERATED_SUBJECTS = ["Merge ", "Revert ", "fixup!", "squash!", "amend!"]
</file context>
There was a problem hiding this comment.
Deliberate, and kept as is. Running the script from CI would mean a checkout plus a Nix install for what is otherwise a single API call, so this job reads the changed files from the API and stays clone-free on ubuntu-slim. Both copies carry a comment pointing at the other, and the rule surface is small on purpose: three constant lists and one path mapping.
`fix(kimi,coding)` passed the check because one valid scope was enough, so a comma-separated list could smuggle an unrelated name past the rule. Require every scope in the list to be allowed. Also skip the PR title job for the labels the shape check already exempts (`autorelease: pending`, `dependencies`), so the two title policies judge the same pull requests.
The profiling skill said the tools under nix/tools run on node; all three are built with bunCli or bunNodeModules and run under Bun, so `node --cpu-prof` would profile nothing. The commit skill's `chore: format` line now says when a scope is required, since an adapter-only format commit needs one.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — two new commits since the prior pullfrog review at f217edae.
- Closed scope bypass in validation —
any→allin bothscripts/validate-commit-scope.nuand.github/workflows/check-pr-title.yamlmeans every scope in a comma-separated list must be in the allowed set. Before this,feat(codex,foo)on a codex change would pass becauseanyfoundcodexvalid; now it correctly rejects becausefoois not. - CI scope job now respects title exemptions — added an
if:condition on the scope job that skips PRs labeledautorelease: pendingordependencies, matching the shape-check job above it so the two title policies agree on which PRs they judge. - Corrected nix/tools runtime in profile skill — the tools under
nix/tools/run under Bun (built withbunCli/bunNodeModules), not Node as previously stated. - Clarified format-commit wording —
chore: formatvschore(<scope>): formatnow references the scope rule instead of an opaquechore(xxx).
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 12
🧹 Nitpick comments (1)
CONTRIBUTING.md (1)
60-68: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument all scopes accepted by the validator.
CONTRIBUTING.mddocuments only single-agent scopes.scripts/validate-commit-scope.nuLines [1-55] also acceptsdeps,release,pricing, andrevert, plusadapter,all, andrustfor workspace changes. Document when contributors should use these scopes. Otherwise, valid multi-agent or cross-cutting commits are not discoverable from the contribution guide.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@CONTRIBUTING.md` around lines 60 - 68, Update the “Commit and PR Titles” section in CONTRIBUTING.md to document every scope accepted by scripts/validate-commit-scope.nu: deps, release, pricing, revert, adapter, all, and rust. Briefly state when to use each scope, including workspace-wide and cross-cutting changes, while preserving the existing single-agent directory-scope guidance.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.agents/skills/commit/references/git-apply.md:
- Around line 3-19: Update the patch-staging guidance to use git apply --cached
--check before git apply --cached -v, so validation targets the index
consistently. Remove the --reject recommendation for commit staging and instruct
users to rebuild the patch and apply it only after all hunks validate cleanly.
In @.agents/skills/create-pr/references/gh-review.md:
- Around line 10-12: Update the inline-comment lookup command described in the
gh pr comment workflow to include the gh api --paginate option when retrieving
pull-request comments. Preserve the existing repository and pull-request
endpoint and subsequent comment-ID selection so comments on later pages can be
found and replied to.
In @.agents/skills/create-pr/references/open-pr.md:
- Around line 11-14: Update the CI description in open-pr.md to state that
check-pr-title.yaml uses a copied inline validator mirroring
scripts/validate-commit-scope.nu, rather than rerunning the script;
alternatively, modify the workflow to invoke the script and retain the existing
description.
In @.agents/skills/create-pr/SKILL.md:
- Line 14: Update the branch guidance in the create-PR workflow to require a
feature branch and pull request unconditionally, removing the exception that
permits direct pushes to main even with user permission. Keep the existing
branch naming convention and commit-scope guidance unchanged.
In @.agents/skills/development/references/commands.md:
- Around line 5-8: Update the command guidance to match the supplied root
justfile: remove schema from the list of Nix-owned whole-repository jobs, unless
a corresponding root schema recipe is added. Keep fmt and check unchanged.
In @.agents/skills/profile/SKILL.md:
- Around line 31-34: Update the profiling guidance in SKILL.md to separate
Node-launched tools from Bun-based tools under nix/tools. Identify
nix/tools/models-dev-gen and the bunCli-built tools as Bun targets, and
prescribe Bun-compatible profiling rather than NODE_OPTIONS or node --cpu-prof;
retain Node launcher guidance only for tools that actually run on Node.
In @.agents/skills/reduce-similarities/SKILL.md:
- Line 5: Update the allowed-tools declaration near the documented similarity-rs
invocation so the Bash allowlist matches the command users are instructed to
run: either permit the full direnv exec . similarity-rs command via an explicit
rule or remove the direnv prefix from the invocation when the bare similarity-rs
command is sufficient.
In @.agents/skills/rust-binary-size/SKILL.md:
- Around line 35-38: Update the Rust inspection commands in the
release-regression guidance to pass --manifest-path rust/Cargo.toml to both
cargo tree and cargo bloat. Keep their existing feature and binary/crate
arguments unchanged so both inspections target the same manifest as the release
build.
In @.agents/skills/skill-creator/SKILL.md:
- Around line 36-38: Update the optional routing fields guidance in SKILL.md to
remove the reference to the TypeScript peer skill and explicitly state the
accepted forms for paths and globs in place. Preserve the existing distinction
between Claude-style paths and cross-runtime globs, and retain the requirement
that Codex triggers belong in description.
In @.agents/skills/tdd/SKILL.md:
- Around line 35-42: Update the Node test command in the TDD instructions to run
through the pinned development environment by prefixing it with direnv exec .,
matching the Rust test commands and preserving the existing test name filter and
target.
In `@scripts/validate-commit-scope.nu`:
- Around line 85-91: Require every declared scope to be allowed by replacing the
any-based validation with all-based validation after the empty-scope check in
scripts/validate-commit-scope.nu (lines 85-91) and the inline validator in
.github/workflows/check-pr-title.yaml (lines 85-93), preserving rejection of
titles containing any disallowed scope.
- Around line 120-127: Update staged-owners in scripts/validate-commit-scope.nu
(lines 120-127) to request cached names with renames disabled so renamed files
yield both paths. Update the changed-file processing in
.github/workflows/check-pr-title.yaml (lines 104-113) to include each file’s
previous_filename when present alongside filename.
---
Nitpick comments:
In `@CONTRIBUTING.md`:
- Around line 60-68: Update the “Commit and PR Titles” section in
CONTRIBUTING.md to document every scope accepted by
scripts/validate-commit-scope.nu: deps, release, pricing, revert, adapter, all,
and rust. Briefly state when to use each scope, including workspace-wide and
cross-cutting changes, while preserving the existing single-agent
directory-scope guidance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 027cb332-1358-448d-8068-20648e8969f1
📒 Files selected for processing (45)
.agents/skills/agent-sources/SKILL.md.agents/skills/ast-grep/SKILL.md.agents/skills/cmux-debug/SKILL.md.agents/skills/commit/SKILL.md.agents/skills/commit/references/commit-guidance.md.agents/skills/commit/references/git-apply.md.agents/skills/commit/references/push.md.agents/skills/commit/references/revertable-commits.md.agents/skills/create-pr/SKILL.md.agents/skills/create-pr/references/ai-review.md.agents/skills/create-pr/references/branch-and-commit.md.agents/skills/create-pr/references/ci.md.agents/skills/create-pr/references/completion.md.agents/skills/create-pr/references/gh-review.md.agents/skills/create-pr/references/merge.md.agents/skills/create-pr/references/open-pr.md.agents/skills/development/SKILL.md.agents/skills/development/references/commands.md.agents/skills/development/references/environment-and-validation.md.agents/skills/docs/SKILL.md.agents/skills/fix-ci/SKILL.md.agents/skills/nushell/SKILL.md.agents/skills/profile/SKILL.md.agents/skills/profile/references/rust.md.agents/skills/profile/references/typescript.md.agents/skills/reduce-similarities/SKILL.md.agents/skills/rust-binary-size/SKILL.md.agents/skills/rust/SKILL.md.agents/skills/skill-creator/SKILL.md.agents/skills/tdd/SKILL.md.agents/skills/tdd/references/node-test.md.agents/skills/tdd/references/rust.md.agents/skills/testing/SKILL.md.agents/skills/testing/references/node-test.md.agents/skills/testing/references/rust.md.agents/skills/typescript/SKILL.md.agents/skills/typescript/references/style.md.github/workflows/check-pr-title.yamlAGENTS.mdCONTRIBUTING.mdapps/ccusage/AGENTS.mddocs/AGENTS.mdnix/git-hooks.nixrust/adapters/AGENTS.mdscripts/validate-commit-scope.nu
💤 Files with no reviewable changes (11)
- .agents/skills/commit/references/commit-guidance.md
- .agents/skills/tdd/references/rust.md
- .agents/skills/typescript/references/style.md
- .agents/skills/development/references/environment-and-validation.md
- .agents/skills/profile/references/typescript.md
- .agents/skills/create-pr/references/completion.md
- .agents/skills/create-pr/references/branch-and-commit.md
- .agents/skills/commit/references/revertable-commits.md
- .agents/skills/create-pr/references/ci.md
- .agents/skills/tdd/references/node-test.md
- .agents/skills/create-pr/references/merge.md
| Stage a hand-built patch without touching the worktree, verifying first: | ||
|
|
||
| ```bash | ||
| # Always verify first before applying. | ||
| git apply --check patch_file.patch | ||
|
|
||
| # Apply with verbose output for debugging. | ||
| git apply -v patch_file.patch | ||
|
|
||
| # Stage without touching the worktree. | ||
| git apply --cached -v patch_file.patch | ||
|
|
||
| # Apply a diff generated between refs. | ||
| git diff main...HEAD -- <file> | git apply -v | ||
| ``` | ||
|
|
||
| `git apply` applies or stages changes without creating commits. `git am` applies | ||
| patches with commit messages and author info preserved. Use `git apply -v` for | ||
| this workflow to keep commit creation explicit and controlled. | ||
|
|
||
| ## Flags | ||
|
|
||
| - `-v, --verbose`: always use this for detailed feedback during application. | ||
| - `--check`: verify whether a patch can be applied cleanly without making | ||
| changes. | ||
| - `--cached`: stage the patch without applying it to the worktree. | ||
| - `--stat`: display affected files before applying. | ||
| - `--whitespace=fix`: automatically correct trailing whitespace issues. | ||
| - `--reject`: create `.rej` files for failed sections instead of aborting | ||
| entirely. | ||
| - `--reverse` / `-R`: revert a previously applied patch. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| Trailing whitespace: | ||
|
|
||
| ```bash | ||
| git apply --check --whitespace=fix patch_file.patch | ||
| git apply --whitespace=fix -v patch_file.patch | ||
| ``` | ||
|
|
||
| Partial failures: | ||
|
|
||
| ```bash | ||
| git apply --reject -v patch_file.patch | ||
| ``` | ||
|
|
||
| Context mismatch: | ||
| Keep `-v` so a failure reports which hunk was rejected. `--stat` lists the | ||
| affected files before applying. | ||
|
|
||
| ```bash | ||
| git apply --ignore-whitespace -v patch_file.patch | ||
| ``` | ||
|
|
||
| Line ending issues: | ||
| When a patch does not apply cleanly: | ||
|
|
||
| ```bash | ||
| git apply --ignore-space-change -v patch_file.patch | ||
| ``` | ||
| - Trailing whitespace: `--whitespace=fix` | ||
| - Only some hunks conflict: `--reject` writes `.rej` files instead of aborting | ||
| - Context mismatch: `--ignore-whitespace` | ||
| - Line-ending differences: `--ignore-space-change` | ||
| - Undo an applied patch: `--reverse` |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
repo="$(mktemp -d)"
trap 'rm -rf "$repo"' EXIT
cd "$repo"
git init -q
git config user.email [email protected]
git config user.name review
printf 'one\ntwo\n' > file.txt
git add file.txt
git commit -qm base
# Make the index differ from the worktree.
printf 'one\nTWO\n' > file.txt
git add file.txt
printf 'one\ntwo\n' > file.txt
cat > change.patch <<'PATCH'
diff --git a/file.txt b/file.txt
--- a/file.txt
+++ b/file.txt
@@ -1,2 +1,2 @@
-one
+ONE
two
PATCH
git apply --check change.patch
if git apply --cached --check change.patch; then
echo "Unexpected: index check passed" >&2
exit 1
fiRepository: ccusage/ccusage
Length of output: 223
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'File location:\n'
git ls-files | grep -F '.agents/skills/commit/references/git-apply.md' || true
printf '\nCurrent file excerpt:\n'
if [ -f .agents/skills/commit/references/git-apply.md ]; then
nl -ba .agents/skills/commit/references/git-apply.md | sed -n '1,80p'
fi
printf '\nBehavioral probe: --check on worktree, --cached --check on index\n'
repo="$(mktemp -d)"
trap 'rm -rf "$repo"' EXIT
cd "$repo"
git init -q
git config user.email [email protected]
git config user.name review
printf 'one\ntwo\n' > file.txt
git add file.txt
git commit -qm base
# Make the index differ from the worktree.
printf 'one\nTWO\n' > file.txt
git add file.txt
printf 'one\ntwo\n' > file.txt
cat > change.patch <<'PATCH'
diff --git a/file.txt b/file.txt
--- a/file.txt
+++ b/file.txt
@@ -1,2 +1,2 @@
-one
+ONE
two
PATCH
printf 'git apply --check exit=%s\n' "$(git apply --check change.patch >/tmp/apply-check.txt 2>/tmp/apply-check.err && echo 0 || echo 1)"
printf 'git apply --cached --check exit=%s\n' "$(git apply --cached --check change.patch >/tmp/apply-cached-check.txt 2>/tmp/apply-cached-check.err && echo 0 || echo 1)"
printf '\nRelevant stderr snippets:\n'
sed -n '1,8p' /tmp/apply-check.err
sed -n '1,8p' /tmp/apply-cached-check.errRepository: ccusage/ccusage
Length of output: 277
Validate the index and keep partial patch application out of commit staging.
git apply --check checks the worktree, while git apply --cached stages against the index. If you stage with --cached --check, the previous step should use --cached --check as well.
Do not recommend --reject for commit staging; it can stage only clean hunks and leave a partial change in the index. Rebuild the patch and stage it only when all hunks apply.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.agents/skills/commit/references/git-apply.md around lines 3 - 19, Update
the patch-staging guidance to use git apply --cached --check before git apply
--cached -v, so validation targets the index consistently. Remove the --reject
recommendation for commit staging and instruct users to rebuild the patch and
apply it only after all hunks validate cleanly.
| `gh pr comment` only posts top-level comments, so replying in the thread a bot | ||
| opened needs the REST replies endpoint with that comment's id (from | ||
| `gh api repos/:owner/:repo/pulls/<pr-number>/comments`): |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
gh api --paginate \
"repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/comments" \
--jq '.[].id'Repository: ccusage/ccusage
Length of output: 203
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Repository files around target:\n'
git ls-files '.agents/skills/create-pr/references/gh-review.md' || true
printf '\nTarget file contents:\n'
if [ -f .agents/skills/create-pr/references/gh-review.md ]; then
cat -n .agents/skills/create-pr/references/gh-review.md | sed -n '1,40p'
fi
printf '\ngh CLI version and help snippets:\n'
if command -v gh >/dev/null 2>&1; then
gh --version | sed -n '1,3p'
gh api --help | sed -n '1,80p' | rg -n 'paginate|page|--paginate' -C 3 || true
fi
printf '\nSearch for gh api pagination usage:\n'
rg -n 'gh api|paginate|pulls/.*/comments' .agents README.md 2>/dev/null || trueRepository: ccusage/ccusage
Length of output: 3861
Paginate the inline-comment lookup.
gh api repos/:owner/:repo/pulls/<pr-number>/comments returns only the first page. If the target comment is on a later page, the command cannot obtain its ID and cannot reply in that thread. Add --paginate.
Proposed fix
-gh api repos/:owner/:repo/pulls/<pr-number>/comments
+gh api --paginate repos/:owner/:repo/pulls/<pr-number>/comments📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| `gh pr comment` only posts top-level comments, so replying in the thread a bot | |
| opened needs the REST replies endpoint with that comment's id (from | |
| `gh api repos/:owner/:repo/pulls/<pr-number>/comments`): | |
| `gh api --paginate repos/:owner/:repo/pulls/<pr-number>/comments` returns only the first page. If the target comment is on a later page, the command cannot obtain its ID and cannot reply in that thread. Add `--paginate`. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.agents/skills/create-pr/references/gh-review.md around lines 10 - 12,
Update the inline-comment lookup command described in the gh pr comment workflow
to include the gh api --paginate option when retrieving pull-request comments.
Preserve the existing repository and pull-request endpoint and subsequent
comment-ID selection so comments on later pages can be found and replied to.
| `just` is the single entry point (`just --list`). Each workspace package owns a | ||
| justfile imported as a module, so package recipes are `just <module>::<recipe>` | ||
| and `just <module>::--list` lists one module. Whole-repo jobs the Nix flake owns | ||
| (`fmt`, `check`, `schema`) stay at the root. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Remove or implement the schema recipe.
The supplied root justfile defines fmt and check, but it does not define schema. Agents that follow this guidance will run a nonexistent command. Remove schema from this list or add the missing root recipe.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.agents/skills/development/references/commands.md around lines 5 - 8, Update
the command guidance to match the supplied root justfile: remove schema from the
list of Nix-owned whole-repository jobs, unless a corresponding root schema
recipe is added. Keep fmt and check unchanged.
There was a problem hiding this comment.
False positive: the root justfile does define a schema recipe (justfile:71, running nix run .#generate-schema), so the documented command exists.
There was a problem hiding this comment.
Skipped: comment is from another GitHub bot.
| When the release profile does not explain a regression, look at feature flags | ||
| (`cargo tree -e features -p ccusage`) and large symbols (`cargo bloat --release | ||
| --bin ccusage --crates`), both against the same manifest. `cargo bloat` is not in | ||
| the dev shell; the `missing-tools` skill covers running it without a flake change. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "File excerpt:"
sed -n '1,70p' .agents/skills/rust-binary-size/SKILL.md 2>/dev/null || true
echo
echo "Cargo manifest files:"
git ls-files '*Cargo.toml' | sed -n '1,120p'
echo
echo "Search related commands in skill and docs:"
rg -n "cargo (tree|build|clippy|benches)|--manifest-path|cd rust|rust/Cargo.toml|cargo bloat" .agents README.md . 2>/dev/null | sed -n '1,200p'
echo
echo "Installed tool availability and option parsing:"
for cmd in cargo cargo-tree cargo-bloat; do
if command -v "$cmd" >/dev/null 2>&1; then
echo "--- $cmd ---"
"$cmd" --version 2>&1 | sed -n '1,5p'
case "$cmd" in
cargo) "$cmd" tree --help 2>&1 | rg -n "manifest|path" || true ;;
cargo-tree) "$cmd" --help 2>&1 | rg -n "manifest|path" || true ;;
cargo-bloat) "$cmd" --help 2>&1 | rg -n "manifest|path" || true ;;
esac
else
echo "--- $cmd: not installed ---"
fi
doneRepository: ccusage/ccusage
Length of output: 145
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "File excerpt:"
sed -n '1,70p' .agents/skills/rust-binary-size/SKILL.md 2>/dev/null || true
echo
echo "Cargo manifest files:"
git ls-files '*Cargo.toml' | sed -n '1,120p'
echo
echo "Search related commands in skill and docs:"
rg -n "cargo (tree|build|clippy|benches)|--manifest-path|cd rust|rust/Cargo.toml|cargo bloat" .agents README.md . 2>/dev/null | sed -n '1,200p'
echo
echo "Installed tool availability and option parsing:"
for cmd in cargo cargo-tree cargo-bloat; do
if command -v "$cmd" >/dev/null 2>&1; then
echo "--- $cmd ---"
"$cmd" --version 2>&1 | sed -n '1,5p'
case "$cmd" in
cargo) "$cmd" tree --help 2>&1 | rg -n "manifest|path" || true ;;
cargo-tree) "$cmd" --help 2>&1 | igrep -n "manifest|path" || true ;;
cargo-bloat) "$cmd" --help 2>&1 | igrep -n "manifest|path" || true ;;
esac
else
echo "--- $cmd: not installed ---"
fi
doneRepository: ccusage/ccusage
Length of output: 145
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "pwd:"
pwd || true
echo
echo "Top-level files:"
find . -maxdepth 1 -type f -not -path '*/\.*' | sed 's#^\./##' | sort | sed -n '1,120p' || true
echo
echo "Cargo manifest files:"
find . -name Cargo.toml -not -path './.git/*' | sort | sed -n '1,120p'
echo
echo "Relevant skill excerpt if present:"
if [ -f .agents/skills/rust-binary-size/SKILL.md ]; then
sed -n '1,80p' .agents/skills/rust-binary-size/SKILL.md
else
find . -path '*/rust-binary-size/SKILL.md' -o -path '*rust-binary-size*' -not -path './.git/*' -maxdepth 4 | sort | sed -n '1,120p' || true
fi
echo
echo "Fast text search in tracked files only for key terms:"
git ls-files '*.md' | while read -r f; do
case "$f" in
.agents/skills/rust-binary-size/SKILL.md|README.md) ;;
*) ;;
esac
done | xargs -r rg -n "cargo (tree|build|bloat|--manifest-path)|cd rust|rust/Cargo.toml|missing-tools" || true
echo
echo "Cargo-related docs anywhere tracked:"
git ls-files '*.md' | xargs -r rg -n "cargo (tree|build|bloat|--manifest-path)|cd rust|rust/Cargo.toml|missing-tools" || trueRepository: ccusage/ccusage
Length of output: 145
🏁 Script executed:
#!/bin/bash
set -u
echo "pwd:"
pwd
printf 'top-level entries:\n'
ls -1A . 2>/dev/null | sed -n '1,80p'
printf 'Cargo manifest files:\n'
find . -name Cargo.toml 2>/dev/null | sort | sed -n '1,120p'
printf 'Target skill excerpt:\n'
sed -n '1,80p' .agents/skills/rust-binary-size/SKILL.md 2>/dev/null || true
printf 'Key command mentions in markdown files:\n'
for f in $(find . -name '*.md' -type f 2>/dev/null | sed -n '1,100p'); do
rg -n "cargo (tree|build|bloat|--manifest-path)|cd rust|rust/Cargo.toml|missing-tools" "$f" 2>/dev/null || true
done
printf 'Installed cargo commands:\n'
command -v cargo || true
command -v cargo-tree || true
command -v cargo-bloat || trueRepository: ccusage/ccusage
Length of output: 145
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' 'quick ls'
ls . 2>/dev/null | sed -n '1,40p'
printf '%s\n' 'skill file exists'
test -f .agents/skills/rust-binary-size/SKILL.md && echo yes || echo no
printf '%s\n' 'lines 1-70'
sed -n '1,70p' .agents/skills/rust-binary-size/SKILL.md 2>/dev/null || trueRepository: ccusage/ccusage
Length of output: 2802
🌐 Web query:
cargo-tree --manifest-path option documentation
💡 Result:
The --manifest-path option for the cargo tree command is used to specify the path to a Cargo.toml file [1][2]. By default, Cargo searches for the Cargo.toml file in the current working directory or any parent directory [1][2]. When the --manifest-path option is provided, Cargo uses the specified path instead of performing this automatic search [1][2]. The manifest file determines which packages are selected for display by default when no specific package selection options are provided [1][2]. If the manifest is the root of a workspace, the workspace's default members are selected; otherwise, only the package defined by the manifest file is selected [3][4][5].
Citations:
- 1: https://doc.rust-lang.org/cargo/commands/cargo-tree.html
- 2: https://doc.rust-lang.org/stable/cargo/commands/cargo-tree.html
- 3: https://github.com/rust-lang/cargo/blob/master/doc/man/generated_txt/cargo-tree.txt
- 4: https://manpages.debian.org/unstable/cargo/cargo-tree.1.en.html
- 5: https://man.archlinux.org/man/cargo-tree.1.en
🌐 Web query:
cargo-bloat --manifest-path option documentation
💡 Result:
The cargo-bloat tool supports the --manifest-path option, which allows you to specify the path to a Cargo.toml file [1][2]. This is useful when you want to run cargo-bloat from a directory other than the root of the crate you are analyzing [3]. This flag was added in version 0.10.0 of cargo-bloat [1][2]. It functions similarly to the --manifest-path flag in standard cargo commands, enabling you to point the tool directly to the project manifest [2]. While it may not always appear in the high-level summary of command-line flags in the README, it is officially supported for passing configuration down to cargo [1][2].
Citations:
- 1: https://github.com/RazrFalcon/cargo-bloat/blob/master/CHANGELOG.md
- 2: RazrFalcon/cargo-bloat@RazrFalcon:88505bc...RazrFalcon:22435eb
- 3: Support --manifest-path RazrFalcon/cargo-bloat#107
Use rust/Cargo.toml for the Rust inspection commands.
The build command already targets rust/Cargo.toml, but cargo tree and cargo bloat run against the current package unless told otherwise. Add --manifest-path rust/Cargo.toml to both commands so the regression check does not inspect a different package from the repository root.
Proposed command fix
- cargo tree -e features -p ccusage
- cargo bloat --release --bin ccusage --crates
+ cargo tree --manifest-path rust/Cargo.toml -e features -p ccusage
+ cargo bloat --manifest-path rust/Cargo.toml --release --bin ccusage --crates📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| When the release profile does not explain a regression, look at feature flags | |
| (`cargo tree -e features -p ccusage`) and large symbols (`cargo bloat --release | |
| --bin ccusage --crates`), both against the same manifest. `cargo bloat` is not in | |
| the dev shell; the `missing-tools` skill covers running it without a flake change. | |
| When the release profile does not explain a regression, look at feature flags | |
| (`cargo tree --manifest-path rust/Cargo.toml -e features -p ccusage`) and large symbols (`cargo bloat --manifest-path rust/Cargo.toml --release | |
| --bin ccusage --crates`), both against the same manifest. `cargo bloat` is not in | |
| the dev shell; the `missing-tools` skill covers running it without a flake change. |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.agents/skills/rust-binary-size/SKILL.md around lines 35 - 38, Update the
Rust inspection commands in the release-regression guidance to pass
--manifest-path rust/Cargo.toml to both cargo tree and cargo bloat. Keep their
existing feature and binary/crate arguments unchanged so both inspections target
the same manifest as the release build.
| Rust tests live in the `rust/Cargo.toml` workspace. Prefix with `direnv exec .` when | ||
| `cargo` is not already on `PATH`. | ||
|
|
||
| ## Workflow | ||
| ```sh | ||
| direnv exec . cargo test --manifest-path rust/Cargo.toml --workspace <name-filter> | ||
| direnv exec . cargo test --manifest-path rust/Cargo.toml --workspace -- --ignored | ||
|
|
||
| 1. **Sketch behaviors** — Before writing any code, list the behaviors to implement as placeholder tests, such as `it.todo(...)` in Node test or `#[ignore]` in Rust. | ||
| 2. **Pick one behavior** — Start with the simplest or most fundamental one. | ||
| 3. **Red** — Write the test. Run it. Confirm it fails for the right reason. | ||
| 4. **Green** — Write the minimum code to pass. Run the test. Confirm it passes. | ||
| 5. **Refactor** — Clean up. Run all affected tests. Confirm everything is green. | ||
| 6. **Repeat** from step 2 until all behaviors are covered. | ||
| node --test --test-name-pattern '<name-filter>' apps/ccusage/src/cli.test.ts |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Run the Node test in the pinned Nix shell.
Line 42 omits the direnv exec . prefix used for the Rust commands. Use direnv exec . node --test ..., or state that the command requires an already active development shell.
As per coding guidelines, prefix one-off commands with direnv exec . when they run outside the pinned development shell.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.agents/skills/tdd/SKILL.md around lines 35 - 42, Update the Node test
command in the TDD instructions to run through the pinned development
environment by prefixing it with direnv exec ., matching the Rust test commands
and preserving the existing test name filter and target.
Source: Coding guidelines
| def staged-owners []: nothing -> list<string> { | ||
| git diff --cached --name-only | ||
| | lines | ||
| | where {|path| ($path | str trim) != "" } | ||
| | each {|path| owner-for-path $path } | ||
| | compact | ||
| | uniq | ||
| | sort |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
repo="$(mktemp -d)"
trap 'rm -rf "$repo"' EXIT
cd "$repo"
git init -q
git config user.email [email protected]
git config user.name review
git config diff.renames true
mkdir -p rust/adapters/codex
printf 'source\n' > rust/adapters/codex/usage.rs
git add .
git commit -qm base
mkdir -p rust/adapters/kimi
git mv rust/adapters/codex/usage.rs rust/adapters/kimi/usage.rs
echo "Current command:"
git diff --cached --name-only
echo "Owner-safe command:"
git diff --cached --no-renames --name-onlyRepository: ccusage/ccusage
Length of output: 275
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Files:"
git ls-files 'scripts/validate-commit-scope.nu' '.github/workflows/check-pr-title.yaml' 'AGENTS.md' 'rust/' | sed -n '1,120p'
echo
echo "Relevant nus scripts:"
if [ -f scripts/validate-commit-scope.nu ]; then
wc -l scripts/validate-commit-scope.nu
sed -n '1,180p' scripts/validate-commit-scope.nu
fi
echo
echo "Relevant workflow excerpts:"
if [ -f .github/workflows/check-pr-title.yaml ]; then
wc -l .github/workflows/check-pr-title.yaml
sed -n '1,160p' .github/workflows/check-pr-title.yaml
fi
echo
echo "Search for owner-for-path/staged-owners/previous_filename:"
rg -n "owner-for-path|staged-owners|changed-owners|previous_filename|AGENTS|rust/adapters|adapter" scripts .github rust docs 2>/dev/null | sed -n '1,220p'Repository: ccusage/ccusage
Length of output: 31375
🌐 Web query:
GitHub pulls list files API previous_filename field documentation
💡 Result:
The previous_filename field is a component of the Diff Entry object used in the GitHub REST API, specifically appearing in the responses for listing files in a pull request and listing files in a commit [1][2]. When a file is renamed, the previous_filename field contains the original name of the file before the rename operation [2]. This field is primarily relevant when the status of the file change is reported as renamed [2]. Technical details: - API endpoints: It is available in the responses for GET /repos/{owner}/{repo}/pulls/{pull_number}/files and GET /repos/{owner}/{repo}/commits/{commit_sha} (as part of the commit file data) [1][2]. - Data structure: It is a string field within the Diff Entry object schema [1][2]. - Usage: Developers can use this field to track file provenance, such as identifying the original path of a file that has been moved or renamed in a pull request or commit [2][3].
Citations:
- 1: https://docs.github.com/en/rest/pulls/pulls
- 2: https://docs.github.com/en/rest/commits/commits
- 3: https://stackoverflow.com/questions/25677352/how-to-get-the-original-file-from-a-renamed-file-from-the-github-api
Include both paths when a file is renamed.
A rename from one adapter to another can report only the destination path, leaving both validators with no derived adapter scope.
scripts/validate-commit-scope.nu#L120-L127: usegit diff --cached --no-renames --name-onlyso a rename produces the deleted and added paths..github/workflows/check-pr-title.yaml#L104-L113: include each changed file'sprevious_filenamewhen it exists, in addition tofilename.
📍 Affects 2 files
scripts/validate-commit-scope.nu#L120-L127(this comment).github/workflows/check-pr-title.yaml#L104-L113
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/validate-commit-scope.nu` around lines 120 - 127, Update
staged-owners in scripts/validate-commit-scope.nu (lines 120-127) to request
cached names with renames disabled so renamed files yield both paths. Update the
changed-file processing in .github/workflows/check-pr-title.yaml (lines 104-113)
to include each file’s previous_filename when present alongside filename.
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.agents/skills/commit/SKILL.md:
- Around line 20-23: Update the workflow around the existing “Read the state and
recent history” and patch-staging steps to explicitly detect untracked files,
since git diff HEAD omits them. Document creating and applying a patch for each
new file before committing, then verify the complete staged file list before the
commit; preserve the existing independently revertable-unit and git show HEAD
checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0a762de2-2b1f-4dd1-a3be-269aa3e8ba4f
📒 Files selected for processing (45)
.agents/skills/agent-sources/SKILL.md.agents/skills/ast-grep/SKILL.md.agents/skills/cmux-debug/SKILL.md.agents/skills/commit/SKILL.md.agents/skills/commit/references/commit-guidance.md.agents/skills/commit/references/git-apply.md.agents/skills/commit/references/push.md.agents/skills/commit/references/revertable-commits.md.agents/skills/create-pr/SKILL.md.agents/skills/create-pr/references/ai-review.md.agents/skills/create-pr/references/branch-and-commit.md.agents/skills/create-pr/references/ci.md.agents/skills/create-pr/references/completion.md.agents/skills/create-pr/references/gh-review.md.agents/skills/create-pr/references/merge.md.agents/skills/create-pr/references/open-pr.md.agents/skills/development/SKILL.md.agents/skills/development/references/commands.md.agents/skills/development/references/environment-and-validation.md.agents/skills/docs/SKILL.md.agents/skills/fix-ci/SKILL.md.agents/skills/nushell/SKILL.md.agents/skills/profile/SKILL.md.agents/skills/profile/references/rust.md.agents/skills/profile/references/typescript.md.agents/skills/reduce-similarities/SKILL.md.agents/skills/rust-binary-size/SKILL.md.agents/skills/rust/SKILL.md.agents/skills/skill-creator/SKILL.md.agents/skills/tdd/SKILL.md.agents/skills/tdd/references/node-test.md.agents/skills/tdd/references/rust.md.agents/skills/testing/SKILL.md.agents/skills/testing/references/node-test.md.agents/skills/testing/references/rust.md.agents/skills/typescript/SKILL.md.agents/skills/typescript/references/style.md.github/workflows/check-pr-title.yamlAGENTS.mdCONTRIBUTING.mdapps/ccusage/AGENTS.mddocs/AGENTS.mdnix/git-hooks.nixrust/adapters/AGENTS.mdscripts/validate-commit-scope.nu
💤 Files with no reviewable changes (11)
- .agents/skills/create-pr/references/completion.md
- .agents/skills/development/references/environment-and-validation.md
- .agents/skills/tdd/references/rust.md
- .agents/skills/profile/references/typescript.md
- .agents/skills/commit/references/commit-guidance.md
- .agents/skills/tdd/references/node-test.md
- .agents/skills/commit/references/revertable-commits.md
- .agents/skills/typescript/references/style.md
- .agents/skills/create-pr/references/merge.md
- .agents/skills/create-pr/references/ci.md
- .agents/skills/create-pr/references/branch-and-commit.md
🚧 Files skipped from review as they are similar to previous changes (20)
- nix/git-hooks.nix
- .agents/skills/typescript/SKILL.md
- .agents/skills/testing/references/node-test.md
- .agents/skills/commit/references/git-apply.md
- .agents/skills/testing/references/rust.md
- .agents/skills/reduce-similarities/SKILL.md
- .agents/skills/docs/SKILL.md
- .agents/skills/commit/references/push.md
- .agents/skills/agent-sources/SKILL.md
- .github/workflows/check-pr-title.yaml
- .agents/skills/create-pr/references/gh-review.md
- .agents/skills/rust-binary-size/SKILL.md
- apps/ccusage/AGENTS.md
- .agents/skills/create-pr/references/ai-review.md
- CONTRIBUTING.md
- .agents/skills/cmux-debug/SKILL.md
- rust/adapters/AGENTS.md
- scripts/validate-commit-scope.nu
- AGENTS.md
- .agents/skills/ast-grep/SKILL.md
| 1. Read the state and recent history — `git status --short`, `git diff HEAD`, `git log --oneline -10` — and match the granularity, scopes, and explanation style already in the log. | ||
| 2. Split the diff into independently revertable units, hunk by hunk rather than file by file. | ||
| 3. Stage each unit with `git apply --cached -v <patch>`. `git add -p` and `git add --interactive` hang in this environment, so a patch is the only way to stage part of a file. Read `references/git-apply.md` when one fails to apply. | ||
| 4. Commit, then confirm with `git show HEAD`. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Handle untracked files before patch-only staging.
git diff HEAD excludes untracked files. A new file can therefore remain unstaged while this workflow appears complete. Add an explicit untracked-file check and document how to apply a new-file patch. Verify the staged file list before committing.
Suggested workflow update
-1. Read the state and recent history — `git status --short`, `git diff HEAD`, `git log --oneline -10` — and match the granularity, scopes, and explanation style already in the log.
+1. Read the state and recent history — `git status --short`, `git diff HEAD`, `git ls-files --others --exclude-standard`, and `git log --oneline -10` — and match the granularity, scopes, and explanation style already in the log.
-3. Stage each unit with `git apply --cached -v <patch>`. `git add -p` and `git add --interactive` hang in this environment, so a patch is the only way to stage part of a file. Read `references/git-apply.md` when one fails to apply.
+3. Stage tracked units with `git apply --cached -v <patch>`. For each untracked file, generate and apply a new-file patch from `/dev/null`. `git add -p` and `git add --interactive` hang in this environment, so use non-interactive patch staging. Read `references/git-apply.md` when one fails to apply.
-4. Commit, then confirm with `git show HEAD`.
+4. Inspect `git diff --cached --name-status`, commit, then confirm with `git show --stat HEAD` and `git status --short`.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 1. Read the state and recent history — `git status --short`, `git diff HEAD`, `git log --oneline -10` — and match the granularity, scopes, and explanation style already in the log. | |
| 2. Split the diff into independently revertable units, hunk by hunk rather than file by file. | |
| 3. Stage each unit with `git apply --cached -v <patch>`. `git add -p` and `git add --interactive` hang in this environment, so a patch is the only way to stage part of a file. Read `references/git-apply.md` when one fails to apply. | |
| 4. Commit, then confirm with `git show HEAD`. | |
| 1. Read the state and recent history — `git status --short`, `git diff HEAD`, `git ls-files --others --exclude-standard`, and `git log --oneline -10` — and match the granularity, scopes, and explanation style already in the log. | |
| 2. Split the diff into independently revertable units, hunk by hunk rather than file by file. | |
| 3. Stage tracked units with `git apply --cached -v <patch>`. For each untracked file, generate and apply a new-file patch from `/dev/null`. `git add -p` and `git add --interactive` hang in this environment, so use non-interactive patch staging. Read `references/git-apply.md` when one fails to apply. | |
| 4. Inspect `git diff --cached --name-status`, commit, then confirm with `git show --stat HEAD` and `git status --short`. |
🧰 Tools
🪛 LanguageTool
[grammar] ~21-~21: Ensure spelling is correct
Context: ...g. 2. Split the diff into independently revertable units, hunk by hunk rather than file by...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.agents/skills/commit/SKILL.md around lines 20 - 23, Update the workflow
around the existing “Read the state and recent history” and patch-staging steps
to explicitly detect untracked files, since git diff HEAD omits them. Document
creating and applying a patch for each new file before committing, then verify
the complete staged file list before the commit; preserve the existing
independently revertable-unit and git show HEAD checks.
Carry over the parts of the personal tdd skill this one was missing — horizontal slicing, tautological expectations, and mocking inside the system — stated against the seams this repository actually has: `--offline`, `CLAUDE_CONFIG_DIR`, and `ccusage-test-support`. The upstream mocking reference is Vitest and MSW throughout, which nothing here uses, so it stays out. Also drop the generic advice on reading a `.cpuprofile` from the profile skill, keeping the part a profiler cannot tell you: no `profiles/` directory is ignored, so the output goes outside the worktree.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — one new commit since the prior pullfrog review at 1f03741c.
- TDD skill gained ccusage-specific failure modes — the three named failure modes (horizontal slicing, tautological expectations, mocking inside the system) replace generic rules. Each references real repo seams:
--offline,CLAUDE_CONFIG_DIR, andccusage-test-support. The cycle now folds placeholder sketching into step 1 and includesjustrecipe references. - Profile skill lost stale
.cpuprofileread instructions — Bun tools undernix/tools/and nushell/babashka scripts inapps/ccusage/scripts/are not Node, so the removed.cpuprofilereading advice was misleading.
@v0 or keep the SHA fresh with Dependabot | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 45 out of 45 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
scripts/validate-commit-scope.nu:29
- Nushell command substitutions in
letassignments need parentheses; otherwise these lines are treated as bare expressions and the commit-msg hook will fail before enforcing scopes.
scripts/validate-commit-scope.nu:2 - This script shells out to
git, but the Nix shebang only includesnushell. If someone runs it directly (or via a hook entry that executes the file), it will fail withgitmissing from PATH. Includenixpkgs#gitin the shebang tool list to make it self-contained.
This issue also appears on line 25 of the same file.
| def main []: nothing -> nothing { | ||
| let title = $env.PR_TITLE | str trim | ||
|
|
||
| if ($GENERATED_SUBJECTS | any {|prefix| $title | str starts-with $prefix }) { return } | ||
|
|
||
| let parsed = $title | parse --regex '^(?<type>[a-z]+)(?:\((?<scope>[^()]+)\))?!?: \S' | get 0? | ||
| if $parsed == null { | ||
| reject $title "is not a Conventional Commit" "Use `<type>(<scope>): <subject>`, for example `feat(codex): add session totals`." | ||
| } | ||
|
|
||
| let owners = changed-owners | ||
| let scopes = $parsed.scope | ||
| | default "" | ||
| | split row "," | ||
| | each {|scope| $scope | str trim } | ||
| | where {|scope| $scope != "" } |
There was a problem hiding this comment.
Nushell has allowed pipelines and command calls directly on the right side of let since 0.72 (this workflow pins 0.114.1), and the identical forms already run in scripts/validate-commit-scope.nu and apps/ccusage/scripts/ensure-native-binary.nu, so no runtime failure occurs.
ccusage performance comparisonPR SHA: This compares the PR package against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |
ccusage performance comparisonPR SHA: This compares the Rust PR release binary against the configured base package on the same CI runner. Package runtime diagnosticsCompares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself. Fixtures: Claude
Committed fixture performanceCommitted small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage. Fixtures: Claude
Large real-world-shaped fixture performanceGenerated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures. Fixtures: Claude
Artifact size
Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees. |

Summary
Two related changes to how this repository instructs agents and names commits.
Skills rewritten for current frontier models. Every skill under
.agents/skillswas rewritten following Anthropic's prompt-reduction work and the context engineering guidance that came out of it — both now linked fromskill-creatorso future edits keep the same bar. Prohibitions and "always" rules became the repo fact plus the judgement it implies, derivable examples are gone, and paraphrases of code became pointers to the file that shows it. Eleven reference files merged into the skill that linked them.AGENTS.md, which loads before an agent knows what it is doing, keeps only routing, repository shape, and the policies an agent would otherwise violate unknowingly.The set drops from 2250 to 1103 lines and
AGENTS.mdfrom 140 to 55, with no repo-specific fact lost — paths,justrecipes, crate and adapter names, fixtures, and validation steps were each checked against the tree.Commit and PR title scopes are now enforced. A subject cannot reveal an invented scope on its own:
feat(coding)reads fine until you know the change was codex. Acommit-msghook reads the ownership off the staged paths and rejects a scope that points elsewhere, or is missing when the change belongs to one adapter. CI applies the same rules to the PR title, since a squash merge makes that title the subject onmain.Why only
rust/adapters/*maps to a scopeReplaying the rules over the last 400 commits showed that deriving a scope from the crates rejects good messages — those crates are catch-alls whose commits are scoped by feature (
cost,statusline,json) rather than by crate name. With adapters alone the replay produces no false rejection, whileperf(rust)andchore(deps)stay available for workspace-wide and cross-cutting changes.Testing
feat(coding)on a codex-only change, multi-adapter changes,rust/adapters/commonderivingadapter, cross-cutting scopes, merge and fixup subjects, and a comment-only message.gh, checking exit codes.just fmtclean,actionlintclean,nu --ide-checkclean on both scripts, and the hook validated every commit in this PR.The PR title check itself only runs once this workflow is on
main, so its first real exercise is the next PR.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled.Summary by cubic
Streamlined repo-local agent skills and enforced Conventional Commit scopes so commit subjects and PR titles reflect the adapter changed, closing a scope-bypass edge case. This reduces docs noise and keeps wrong scopes off
main.New Features
commit-msghook vianix/git-hooks.nixthat runsscripts/validate-commit-scope.nu, and a PR title check in.github/workflows/check-pr-title.yamlwith the same rules.Refactors
.agents/skillsfor clarity; merged 11 references; reduced content from 2250 → 1103 lines. TrimmedAGENTS.mdto routing and policy; aligned package/adapters docs; corrected nix/tools runtime (Bun) and clarified whenchore: formatneeds an adapter scope.--offline,CLAUDE_CONFIG_DIR, andccusage-test-support); removed generic.cpuprofilereading advice.Written for commit 717d77b. Summary will update on new commits.
Summary by CodeRabbit
Documentation
Quality Improvements