bb-cc-lite 0.1.10 → 0.1.12
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.
- package/README.md +166 -54
- package/dist/audit.d.ts +47 -0
- package/dist/audit.js +427 -0
- package/dist/audit.js.map +1 -0
- package/dist/cli.js +47 -4
- package/dist/cli.js.map +1 -1
- package/dist/decision-presentation.d.ts +2 -1
- package/dist/decision-presentation.js +3 -2
- package/dist/decision-presentation.js.map +1 -1
- package/dist/event-store-persistence.d.ts +1 -0
- package/dist/event-store-persistence.js +64 -1
- package/dist/event-store-persistence.js.map +1 -1
- package/dist/event-store-queries.js +5 -2
- package/dist/event-store-queries.js.map +1 -1
- package/dist/failure-episodes.d.ts +6 -2
- package/dist/failure-episodes.js +8 -8
- package/dist/failure-episodes.js.map +1 -1
- package/dist/feedback-outcomes.d.ts +9 -0
- package/dist/feedback-outcomes.js +190 -0
- package/dist/feedback-outcomes.js.map +1 -0
- package/dist/hook-control.js +30 -7
- package/dist/hook-control.js.map +1 -1
- package/dist/hook-payload.d.ts +4 -1
- package/dist/hook-payload.js +7 -3
- package/dist/hook-payload.js.map +1 -1
- package/dist/project-config.d.ts +6 -0
- package/dist/project-config.js +93 -0
- package/dist/project-config.js.map +1 -0
- package/dist/renderer.js +7 -5
- package/dist/renderer.js.map +1 -1
- package/dist/statusline.js +10 -3
- package/dist/statusline.js.map +1 -1
- package/dist/store.d.ts +4 -1
- package/dist/store.js +31 -1
- package/dist/store.js.map +1 -1
- package/dist/tool-metadata.d.ts +2 -0
- package/dist/tool-metadata.js +20 -2
- package/dist/tool-metadata.js.map +1 -1
- package/dist/transcript.d.ts +7 -2
- package/dist/transcript.js +7 -7
- package/dist/transcript.js.map +1 -1
- package/dist/types.d.ts +20 -0
- package/dist/why.d.ts +15 -2
- package/dist/why.js +130 -5
- package/dist/why.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,48 +2,96 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/softcane/bb-cc-lite/actions/workflows/ci.yml)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Behavioral health monitoring for Claude Code sessions.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Claude Code can look busy while doing the wrong thing. It can retry the same failed test, edit without verification, burn tokens, fill the context window, thrash across files, and keep going long after a human should stop it.
|
|
8
|
+
|
|
9
|
+
The small local status line answers one question:
|
|
8
10
|
|
|
9
11
|
> Should I let this Claude Code session keep going?
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Token spend tells you what it cost. `bb-cc-lite` tries to show whether the session behavior still looks healthy: continue, verify, or stop before more turns are burned.
|
|
14
|
+
|
|
15
|
+
It is local. It is not a cloud dashboard, telemetry service, proxy, gateway, or message router.
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
bb: Healthy | ctx 42% | $0.18 | continue normally
|
|
19
|
+
bb: Healthy | validation resolved | continue normally
|
|
20
|
+
bb: Careful | edits have not been checked yet | run the smallest relevant check
|
|
21
|
+
bb: Careful | same test failed twice without a fix | inspect first failure
|
|
22
|
+
bb: Careful | 9 non-read tool calls, no check or recovery seen | pause and ask what changed
|
|
23
|
+
bb: Stop | why: same failure retried 3x without a fix | do: stop and inspect first failure
|
|
24
|
+
```
|
|
12
25
|
|
|
13
26
|

|
|
14
27
|
|
|
15
|
-
|
|
28
|
+
_The demo shows the difference between healthy progress, unchecked edits, repeated validation failures, and Stop-level retry loops._
|
|
16
29
|
|
|
17
|
-
|
|
18
|
-
- Claude Code with status line support
|
|
30
|
+
## Why This Exists
|
|
19
31
|
|
|
20
|
-
|
|
32
|
+
Activity is not progress.
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
npx --yes bb-cc-lite install --scope local
|
|
24
|
-
```
|
|
34
|
+
The hard part is not seeing that Claude Code is active. The hard part is knowing whether its activity is still useful. Busy output, tool calls, and token spend can hide negative progress.
|
|
25
35
|
|
|
26
|
-
|
|
36
|
+
Humans usually notice too late: after the same check has failed three times, after a broad edit streak was never verified, or after the context window is already under pressure.
|
|
27
37
|
|
|
28
|
-
|
|
38
|
+
`bb-cc-lite` watches local derived signals from the Claude Code status input, transcript tail, and optional hooks. It classifies the current session as `Healthy`, `Careful`, or `Stop`.
|
|
29
39
|
|
|
30
|
-
|
|
40
|
+
## What It Catches
|
|
31
41
|
|
|
32
|
-
|
|
42
|
+
- Retry loops where the same validation check or tool fails repeatedly without a fix.
|
|
43
|
+
- Repeated test, lint, typecheck, or build failures.
|
|
44
|
+
- Long edit streaks without a test, lint, typecheck, or build check.
|
|
45
|
+
- Busy sessions with many tool calls but no observed check or recovery.
|
|
46
|
+
- Context pressure before the session gets too full to reason clearly.
|
|
47
|
+
- Cost and time budget warnings that make a stuck session easier to spot.
|
|
48
|
+
- Local baseline patterns, when there is enough aggregate local history.
|
|
33
49
|
|
|
34
|
-
|
|
50
|
+
## Healthy / Careful / Stop
|
|
35
51
|
|
|
36
|
-
|
|
37
|
-
|
|
52
|
+
`Healthy` means the session still looks safe to continue.
|
|
53
|
+
|
|
54
|
+
`Careful` means slow down. Ask for verification, inspect the pattern, or make the next step smaller.
|
|
55
|
+
|
|
56
|
+
`Stop` does not mean the project failed. It means the session pattern is no longer worth blindly continuing. Take over, redirect Claude, or inspect the first failure before spending more turns.
|
|
57
|
+
|
|
58
|
+
## How It Helps Claude
|
|
59
|
+
|
|
60
|
+
`bb-cc-lite` can run in three install modes.
|
|
61
|
+
|
|
62
|
+
`observe-only` keeps the status line and local derived event data, but does not send feedback to Claude.
|
|
63
|
+
|
|
64
|
+
`coach` is the default. It keeps the status line and can send short, safe Claude-facing notes when a risky pattern is visible, such as repeated validation failure, unchecked edits, high budget with no progress signal, or unresolved validation risk at finish.
|
|
65
|
+
|
|
66
|
+
`guard` includes coach feedback. It may deny a high-confidence repeated Bash validation retry, such as rerunning the same test/lint/typecheck/build category after repeated failures without an edit or passing check. It does not broadly block normal reads, edits, or arbitrary commands.
|
|
67
|
+
|
|
68
|
+
`bb-cc-lite` also records safe feedback outcomes. For example, if bb asks Claude to validate after an edit and Claude runs a passing test, `bb-cc-lite why` can show that the feedback was resolved.
|
|
69
|
+
|
|
70
|
+
When available, `why` includes the recent bb loop:
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
Recent bb loop:
|
|
74
|
+
1. Coach feedback: edits needed validation.
|
|
75
|
+
2. Claude ran tests.
|
|
76
|
+
3. Tests passed.
|
|
77
|
+
4. Outcome: resolved.
|
|
38
78
|
```
|
|
39
79
|
|
|
40
|
-
|
|
80
|
+
## Install
|
|
81
|
+
|
|
82
|
+
Requirements:
|
|
83
|
+
|
|
84
|
+
- Node.js 20 or newer
|
|
85
|
+
- Claude Code with status line support
|
|
41
86
|
|
|
42
87
|
```bash
|
|
43
|
-
|
|
44
|
-
bb-cc-lite install --scope local --hooks
|
|
88
|
+
npx --yes bb-cc-lite install --scope local
|
|
45
89
|
```
|
|
46
90
|
|
|
91
|
+
Restart Claude Code in the project. The status line appears at the bottom.
|
|
92
|
+
|
|
93
|
+
Default install uses coach mode and builds a small local baseline when possible. It preserves an existing Claude Code `statusLine` unless you pass `--replace`.
|
|
94
|
+
|
|
47
95
|
To replace an existing status line:
|
|
48
96
|
|
|
49
97
|
```bash
|
|
@@ -56,66 +104,69 @@ To observe only, without sending feedback to Claude:
|
|
|
56
104
|
npx --yes bb-cc-lite install --scope local --observe-only
|
|
57
105
|
```
|
|
58
106
|
|
|
59
|
-
To enable stricter
|
|
107
|
+
To enable stricter repeated-validation retry denial:
|
|
60
108
|
|
|
61
109
|
```bash
|
|
62
110
|
npx --yes bb-cc-lite install --scope local --guard
|
|
63
111
|
```
|
|
64
112
|
|
|
65
|
-
Guard mode includes coach feedback. It may deny a high-confidence repeated validation retry with a safe reason. It does not broadly block normal reads or edits.
|
|
66
|
-
|
|
67
113
|
To disable baseline learning and lesson memory:
|
|
68
114
|
|
|
69
115
|
```bash
|
|
70
116
|
npx --yes bb-cc-lite install --scope local --no-learn
|
|
71
117
|
```
|
|
72
118
|
|
|
73
|
-
|
|
119
|
+
To uninstall:
|
|
74
120
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- Context pressure before the session gets too full to reason clearly.
|
|
79
|
-
- Cost and time budget signals that make a stuck session easier to spot.
|
|
80
|
-
- Project baseline patterns, when there is enough local aggregate history.
|
|
121
|
+
```bash
|
|
122
|
+
npx --yes bb-cc-lite uninstall --scope local
|
|
123
|
+
```
|
|
81
124
|
|
|
82
|
-
|
|
125
|
+
Prefer a global install?
|
|
83
126
|
|
|
84
|
-
|
|
127
|
+
```bash
|
|
128
|
+
npm install -g bb-cc-lite
|
|
129
|
+
bb-cc-lite install --scope local
|
|
130
|
+
```
|
|
85
131
|
|
|
86
|
-
|
|
132
|
+
Supported install scopes are `local`, `project`, and `user`. Use `local` for the current repo unless you have a specific reason to edit project or user Claude settings.
|
|
87
133
|
|
|
88
|
-
|
|
134
|
+
## Try Before Installing
|
|
89
135
|
|
|
90
|
-
|
|
136
|
+
Run a retrospective audit against recent local Claude Code history:
|
|
91
137
|
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
bb: Careful | 9 tool calls, no check or recovery seen | pause and ask Claude what changed
|
|
96
|
-
bb: Careful | session ran 1h plus 9 tool calls, no check or recovery seen | pause and ask Claude what changed before continuing
|
|
97
|
-
bb: Careful | same test failed twice without a fix | inspect first failure
|
|
98
|
-
bb: Careful | tests failed twice; usually passes after one targeted fix | inspect first failure
|
|
99
|
-
bb: Careful | estimated cost $2.25 | ask Claude to summarize progress before continuing
|
|
100
|
-
bb: Stop | why: same failure retried 3x without a fix | do: stop and inspect first failure
|
|
101
|
-
bb: Stop | why: test loop rarely recovered after 3 failures | do: stop retrying and inspect first failure
|
|
102
|
-
bb: Stop | why: high cost plus repeated failures | do: stop and inspect first failure
|
|
138
|
+
```bash
|
|
139
|
+
npx --yes bb-cc-lite audit --project .
|
|
140
|
+
npx --yes bb-cc-lite audit --all-projects --recent 200
|
|
103
141
|
```
|
|
104
142
|
|
|
105
|
-
`
|
|
143
|
+
`audit` scans recent local Claude Code JSONL history and reports where `bb-cc-lite` would have warned. It highlights repeated retries and risky session patterns; it only shows duplicate retry cost/time when the transcript contains usable measured metadata. It does not install a status line or hooks. Use `--all-projects` only when you want to inspect newest transcripts across local Claude projects.
|
|
106
144
|
|
|
107
145
|
## Useful Commands
|
|
108
146
|
|
|
109
147
|
```bash
|
|
148
|
+
bb-cc-lite audit --project .
|
|
149
|
+
bb-cc-lite audit --all-projects --recent 200
|
|
110
150
|
bb-cc-lite why
|
|
111
151
|
bb-cc-lite doctor
|
|
152
|
+
bb-cc-lite doctor --baseline
|
|
112
153
|
bb-cc-lite unlearn
|
|
113
154
|
bb-cc-lite uninstall --scope local
|
|
114
155
|
```
|
|
115
156
|
|
|
116
|
-
`
|
|
157
|
+
`audit` scans recent history without installing.
|
|
158
|
+
|
|
159
|
+
`why` explains the latest stored status line decision and recent feedback outcomes when available. It reads the local derived event store; it does not reopen transcripts to expose raw content. Interactive `why` output is lightly colored; set `NO_COLOR=1` or `BB_CC_LITE_COLOR=0` for plain text.
|
|
160
|
+
|
|
161
|
+
`doctor` checks Node, Claude settings, optional hooks, transcript access, pricing cache, and related diagnostics.
|
|
162
|
+
|
|
163
|
+
`doctor --baseline` shows safe aggregate baseline facts.
|
|
164
|
+
|
|
165
|
+
`unlearn` clears learned personal baselines, project baselines, and lesson memory.
|
|
117
166
|
|
|
118
|
-
|
|
167
|
+
`uninstall` removes bb-owned status line and hooks. When a valid backup exists, it restores the previous Claude Code status line.
|
|
168
|
+
|
|
169
|
+
Budget thresholds can be changed with environment variables:
|
|
119
170
|
|
|
120
171
|
```bash
|
|
121
172
|
BB_CC_LITE_BUDGET_COST_USD=1.25
|
|
@@ -123,14 +174,75 @@ BB_CC_LITE_BUDGET_COST_DELTA_USD=0.25
|
|
|
123
174
|
BB_CC_LITE_BUDGET_DURATION_MINUTES=30
|
|
124
175
|
```
|
|
125
176
|
|
|
177
|
+
## Validation Signals
|
|
178
|
+
|
|
179
|
+
`bb-cc-lite` observes checks Claude Code runs. It does not run tests, lint, typecheck, or build commands by itself.
|
|
180
|
+
|
|
181
|
+
It recognizes common Bash validation commands and groups them into safe categories:
|
|
182
|
+
|
|
183
|
+
- tests
|
|
184
|
+
- lint
|
|
185
|
+
- typecheck
|
|
186
|
+
- build
|
|
187
|
+
|
|
188
|
+
Those categories are used for retry-loop detection, recovery baselines, coach feedback, and guard-mode retry denial.
|
|
189
|
+
|
|
190
|
+
## Project-Specific Checks
|
|
191
|
+
|
|
192
|
+
If your project uses custom validation commands, you can add an optional `.bb-cc-lite.json`:
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"validationCommands": {
|
|
197
|
+
"tests": ["make test"],
|
|
198
|
+
"lint": ["make lint"],
|
|
199
|
+
"build": ["make build"]
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
This file is not generated automatically. It is only needed when you want to teach bb what your project's test, lint, typecheck, or build commands look like. bb uses it for classification, but does not copy those raw commands into its event history.
|
|
205
|
+
|
|
206
|
+
## When This Is Useful
|
|
207
|
+
|
|
208
|
+
- Claude keeps retrying the same failing test.
|
|
209
|
+
- Claude edits many files without running checks.
|
|
210
|
+
- Context is getting high and reasoning quality may drop.
|
|
211
|
+
- Cost or time is climbing but validation is not improving.
|
|
212
|
+
- A session has many tool calls but no clear recovery signal.
|
|
213
|
+
- You want a quick signal before deciding to continue or intervene.
|
|
214
|
+
- You want local feedback without adding a dashboard or service.
|
|
215
|
+
|
|
126
216
|
## Privacy
|
|
127
217
|
|
|
128
|
-
|
|
218
|
+
`bb-cc-lite` is local-first. There is no cloud backend, SaaS dashboard, transcript upload, proxy, gateway, or message router.
|
|
219
|
+
|
|
220
|
+
The health event store and baselines use derived metadata only: state, reason code, counts, rates, percentiles, confidence labels, feedback outcomes such as `resolved` or `ignored`, safe categories such as `tests`, token/cost/context fields, timestamps, weak pattern labels, hashed session keys, and hashed project keys.
|
|
221
|
+
|
|
222
|
+
The health data is designed not to store prompts, assistant text, tool output, shell output, command arguments, file contents, transcript paths, workspace paths, API keys, raw Claude session ids, or raw MCP names.
|
|
223
|
+
|
|
224
|
+
Local files live under `~/.claude/bb-cc-lite` by default, unless `BB_CC_LITE_HOME` or other override environment variables are set. This includes:
|
|
225
|
+
|
|
226
|
+
- `events.json` for derived local decisions and hook events.
|
|
227
|
+
- `baseline.json` for the personal aggregate baseline.
|
|
228
|
+
- `project-baselines/<hashed-project>.json` for aggregate project baselines.
|
|
229
|
+
- `project-lessons/<hashed-project>.json` for decaying project lesson memory.
|
|
230
|
+
- `litellm-pricing.json` for cached public pricing data when refreshed.
|
|
231
|
+
- `backups/` for Claude settings backups used by uninstall.
|
|
129
232
|
|
|
130
|
-
|
|
233
|
+
Install backups are local settings snapshots so uninstall can restore prior Claude settings. They may contain whatever status line, hook commands, or paths existed in those Claude settings. They are not uploaded by `bb-cc-lite`.
|
|
131
234
|
|
|
132
|
-
|
|
235
|
+
LiteLLM is used only as public pricing data for cost estimates. `bb-cc-lite` does not run a LiteLLM proxy or route messages.
|
|
133
236
|
|
|
134
|
-
|
|
237
|
+
## More Examples
|
|
135
238
|
|
|
136
|
-
|
|
239
|
+
```text
|
|
240
|
+
bb: Healthy | read-only exploration | continue normally
|
|
241
|
+
bb: Careful | estimated cost $2.25 | ask Claude to summarize progress before continuing
|
|
242
|
+
bb: Careful | session ran 1h plus 9 non-read tool calls, no check or recovery seen | pause and ask what changed before continuing
|
|
243
|
+
bb: Careful | ctx 83% | ask Claude for a 6-bullet handoff before more work
|
|
244
|
+
bb: Careful | compaction event seen | ask Claude to restate current goal and next 3 steps
|
|
245
|
+
bb: Careful | tests failed twice; usually passes after one targeted fix | inspect first failure
|
|
246
|
+
bb: Stop | why: same test retried after feedback | do: inspect first failure
|
|
247
|
+
bb: Stop | why: test loop rarely recovered after 3 failures | do: stop retrying and inspect first failure
|
|
248
|
+
```
|
package/dist/audit.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { DecisionConfidence, DecisionState } from "./types.js";
|
|
2
|
+
export interface AuditOptions {
|
|
3
|
+
projectDir?: string;
|
|
4
|
+
homeDir?: string;
|
|
5
|
+
transcriptPath?: string;
|
|
6
|
+
allProjects?: boolean;
|
|
7
|
+
recent?: number;
|
|
8
|
+
maxBytesPerTranscript?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AuditReport {
|
|
11
|
+
scope: "project" | "all-projects" | "transcript";
|
|
12
|
+
recentLimit: number;
|
|
13
|
+
sessionsScanned: number;
|
|
14
|
+
transcriptsFound: number;
|
|
15
|
+
unreadableTranscripts: number;
|
|
16
|
+
sessionsWithFindings: number;
|
|
17
|
+
findings: AuditFinding[];
|
|
18
|
+
repeatedRetriesSpotted: number;
|
|
19
|
+
estimatedSavings: AuditSavingsEstimate;
|
|
20
|
+
reportConfidence: DecisionConfidence;
|
|
21
|
+
reportConfidenceReason: string;
|
|
22
|
+
}
|
|
23
|
+
export interface AuditFinding {
|
|
24
|
+
session: number;
|
|
25
|
+
state: DecisionState;
|
|
26
|
+
confidence: DecisionConfidence;
|
|
27
|
+
reasonCode: string;
|
|
28
|
+
evidence: string;
|
|
29
|
+
action: string;
|
|
30
|
+
repeatedRetries?: number;
|
|
31
|
+
estimatedDurationMs?: number;
|
|
32
|
+
estimatedCostUsd?: number;
|
|
33
|
+
savingsEstimateSource?: "measured" | "fallback";
|
|
34
|
+
}
|
|
35
|
+
export interface AuditSavingsEstimate {
|
|
36
|
+
durationMinutes: number;
|
|
37
|
+
costUsd: number;
|
|
38
|
+
repeatedToolRunsAvoided: number;
|
|
39
|
+
confidence: DecisionConfidence;
|
|
40
|
+
basis: string;
|
|
41
|
+
measured: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface FormatAuditReportOptions {
|
|
44
|
+
color?: boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare function runAudit(options?: AuditOptions): Promise<AuditReport>;
|
|
47
|
+
export declare function formatAuditReport(report: AuditReport, options?: FormatAuditReportOptions): string;
|