feat(cc)!: wave A — project scope default, lazy heartbeat, terse surface - #108
#108Merged
github-actions[bot] merged 1 commit intoMay 7, 2026
mainanipotts/claude-code-tips:mainfrom
feat/cc-wave-a-scope-lazy-trimanipotts/claude-code-tips:feat/cc-wave-a-scope-lazy-trimCopy head branch name to clipboard
Merged
feat(cc)!: wave A — project scope default, lazy heartbeat, terse surface#108github-actions[bot] merged 1 commit intomainanipotts/claude-code-tips:mainfrom feat/cc-wave-a-scope-lazy-trimanipotts/claude-code-tips:feat/cc-wave-a-scope-lazy-trimCopy head branch name to clipboard
github-actions[bot] merged 1 commit into
mainanipotts/claude-code-tips:mainfrom
feat/cc-wave-a-scope-lazy-trimanipotts/claude-code-tips:feat/cc-wave-a-scope-lazy-trimCopy head branch name to clipboard
Conversation
Three orthogonal simplifications that every cc session benefits from on every turn. Closes #74 (per-project scope), addresses #68 (model-aware context surface), and removes the 30s heartbeat thread. 1. Per-project scope default (#74) `cc(action='sessions')` and `cc(action='check')` default to scope='project': peers in the same git project_root as the caller. Opt-in scope='global' restores the v3 behavior. Non-git cwds fall back to global automatically. On a machine running multiple claudes across multiple repos, this drops the listed peer count to the ones that can plausibly collide with you. 2. Lazy heartbeat Drops the 30s setInterval. last_seen + git context now refresh on every action call AND on every transcript-tail readDelta. A new onActivity callback wires the two: transcript activity is the natural liveness signal for sessions that aren't calling cc actions. Git context refresh is rate-limited to 60s so a busy edit burst doesn't fork `git rev-parse` per line. Net: one fewer thread, no behavior change for active sessions, silent sessions correctly stale after STALE_SESSION_AFTER_MS. 3. Terse model-facing surface TOOL_DESCRIPTION trimmed 570 → 276 chars. SERVER_INSTRUCTIONS trimmed 700 → 312 chars. Routing/identity/overlap detail moves to SKILL.md where the skill-triage model already reads it. Security guards (prompt-injection defense + exfil refusal) stay in instructions, since they're load-bearing for every call. Test threshold lowered to 512B. Cumulative per-session system prompt savings: ~700 chars × every cc session × every turn. Material for haiku tier; rounding error for opus 1M. Honest about the asymmetry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
@claude @codex please review this pr per .github/AI_REVIEW_RUBRIC.md. lanes:
output one pr comment each in the exact shape from the rubric. if an app is not installed on this repo, the mention sits unanswered and ci stays green. |
Contributor
quality gate: all checks passed
automated check -- see CLAUDE.md for conventions. |
|
To use Codex here, create a Codex account and connect to github. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three orthogonal simplifications that every cc session benefits from on every turn. Closes #74, addresses #68 morally, removes the 30s heartbeat thread.
Changes
1. Per-project scope default (resolves #74)
cc(action='sessions')andcc(action='check')default toscope='project': peers in the same gitproject_rootas the caller. Opt-inscope='global'restores v3 behavior. Non-git cwds fall back to global automatically. On a machine running 5 claudes across 3 repos, this drops the listed peer count to the ones that can plausibly collide with you.2. Lazy heartbeat (drops the 30s timer)
setIntervaldeleted from lifecyclelast_seen+ git context refresh now: (a) every action call, (b) everytranscript-tailreadDeltavia a newonActivitycallbackgit rev-parseper lineSTALE_SESSION_AFTER_MS. Transcript activity is the natural liveness signal.3. Terse model-facing surface (addresses #68)
TOOL_DESCRIPTION: 570 → 276 charsSERVER_INSTRUCTIONS: 700 → 312 charsSKILL.md(already the skill-triage entrypoint)Cumulative per-session system prompt savings: ~700 chars × every cc session × every turn. Material for Haiku tier; rounding error for Opus 1M. Honest about the asymmetry.
Test plan
bun test tests/— 36 pass (was 35, added test refactor)CLAUDE_CODE_SESSION_ID=... bun run smoke— server boots, instructions block correct lengthtools/listreturnsoneOfschema withscopeonsessions+checkonlybunx tsc --noEmit— clean (pre-existing schema.sql warning unrelated)Breaking?
!per conventional commits —cc(action='sessions')andcc(action='check')now scope to project by default. Existing callers wanting the old behavior passscope: 'global'. Schema bytes change once (one prompt-cache invalidation), then byte-stable forever.🤖 Generated with Claude Code