ctxtop 4.0.0 → 4.1.0
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/.antigravity-plugin/plugin.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHECKSUMS.sha256 +59 -42
- package/README.md +351 -330
- package/bin/ah-statusline.mjs +30 -0
- package/bin/ctxtop.mjs +330 -5
- package/config/default_flightcheck.json +19 -0
- package/config/modelCatalog.json +165 -0
- package/hooks/handlers/compact-lifecycle.mjs +323 -8
- package/hooks/handlers/config-change.mjs +402 -0
- package/hooks/handlers/hookIo.mjs +56 -0
- package/hooks/handlers/post-model-switch.mjs +111 -0
- package/hooks/handlers/post-tool-use.mjs +117 -16
- package/hooks/handlers/pre-model-switch.mjs +823 -24
- package/hooks/handlers/pre-tool-use.mjs +271 -4
- package/hooks/handlers/stop-gate.mjs +297 -11
- package/hooks/handlers/user-prompt-submit.mjs +224 -0
- package/hooks/hooks.json +50 -0
- package/hooks/post_tool_use.mjs +8 -0
- package/hooks/register.js +48 -9
- package/hooks/session_start.mjs +11 -1
- package/hooks/stop.mjs +11 -1
- package/package.json +11 -4
- package/packages/antigravity/package.json +1 -1
- package/packages/claude-code/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/packages/engine-node/package.json +1 -1
- package/packages/mcp/package.json +1 -1
- package/packages/mcp/src/server.mjs +1 -1
- package/packages/pro/package.json +1 -1
- package/plugin.json +1 -1
- package/sidecars/horizon-daemon/server.mjs +38 -2
- package/skills/handoff/SKILL.md +8 -0
- package/src/adapters/antigravity/index.mjs +31 -1
- package/src/adapters/claude-code/index.mjs +40 -1
- package/src/cli/horizon_hud.mjs +254 -52
- package/src/config/modelCatalog.json +84 -0
- package/src/core/bucket_b_runtime.mjs +1200 -0
- package/src/core/constants.mjs +191 -4
- package/src/core/detectors_det01_to_16.mjs +54 -5
- package/src/core/doc_indexer.mjs +338 -0
- package/src/core/layer5_hygiene.mjs +118 -0
- package/src/core/parser.mjs +2 -1
- package/src/core/paths.mjs +3 -2
- package/src/core/rsl_clash_auditor.mjs +423 -0
- package/src/core/rsl_distiller.mjs +372 -0
- package/src/core/rsl_ledger.mjs +969 -0
- package/src/core/rsl_triage.mjs +909 -0
- package/src/core/session_auditor.mjs +658 -0
- package/src/core/shield_manager.mjs +1417 -0
- package/src/core/task_quota_router.mjs +1 -1
- package/src/core-isomorphic/coach/cacheGravityRouter.mjs +874 -47
- package/src/core-isomorphic/coach/resumeToolsetAuditor.mjs +321 -0
- package/src/core-isomorphic/coach/smartCompactAdvisor.mjs +305 -0
- package/src/core-isomorphic/coach/ttlWatchdog.mjs +13 -6
- package/src/core-isomorphic/config/anthropicModelCatalog.json +404 -1
- package/src/core-isomorphic/config/catalogLoader.mjs +546 -46
- package/src/core-isomorphic/config/horizonConfig.mjs +47 -1
- package/src/core-isomorphic/diagnostics/prompt_hygiene_governor.mjs +266 -0
- package/src/core-isomorphic/economics/cacheGravity.mjs +18 -0
- package/src/core-isomorphic/economics/cliffBreaker.mjs +98 -12
- package/src/core-isomorphic/economics/driftLatency.mjs +114 -0
- package/src/core-isomorphic/guards/bucketBAlphaBeta.mjs +860 -0
- package/src/core-isomorphic/guards/bucketBGamma.mjs +442 -0
- package/src/core-isomorphic/guards/bucketBHeuristics.mjs +37 -0
- package/src/core-isomorphic/guards/circuitBreakers.mjs +191 -191
- package/src/core-isomorphic/guards/det01_03_shell_secret.mjs +154 -5
- package/src/core-isomorphic/guards/det04_12_thrash_rot.mjs +103 -11
- package/src/core-isomorphic/guards/det13_20_mcp_scope.mjs +311 -1
- package/src/core-isomorphic/guards/docIndexCore.mjs +446 -0
- package/src/core-isomorphic/guards/losslessPostSanitizer.mjs +16 -0
- package/src/core-isomorphic/guards/slopsquatGate.mjs +551 -0
- package/src/core-isomorphic/index.js +1 -0
- package/src/core-isomorphic/telemetry/telemetryBridge.mjs +36 -12
- package/src/core-isomorphic/ui/horizonPanelHtml.mjs +293 -237
- package/src/core-isomorphic/ui/modViews.mjs +35 -9
- package/src/diagnostics/claudeHookCapabilities.mjs +396 -0
- package/src/diagnostics/doctorEngine.mjs +95 -3
- package/src/engine-node/db/probe.mjs +234 -2
- package/src/engine-node/index.mjs +3 -0
- package/src/engine-node/sensors/blindspots.mjs +13 -6
- package/src/hooks/antigravity_rsl_hook.mjs +250 -0
- package/src/hooks/claude_rsl_hook.mjs +288 -0
- package/src/hooks/post_invocation.mjs +196 -4
- package/src/hooks/pre_invocation.mjs +732 -22
- package/src/hooks/session_start.mjs +39 -1
- package/src/utils/modelSwitchTelemetry.mjs +308 -0
- package/src/utils/sessionCalibration.mjs +657 -0
- package/src/webview/horizon_panel.html +1325 -317
package/hooks/hooks.json
CHANGED
|
@@ -36,6 +36,16 @@
|
|
|
36
36
|
]
|
|
37
37
|
}
|
|
38
38
|
],
|
|
39
|
+
"PostModelSwitch": [
|
|
40
|
+
{
|
|
41
|
+
"hooks": [
|
|
42
|
+
{
|
|
43
|
+
"type": "command",
|
|
44
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/handlers/post-model-switch.mjs\""
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
],
|
|
39
49
|
"PreCompact": [
|
|
40
50
|
{
|
|
41
51
|
"hooks": [
|
|
@@ -76,6 +86,46 @@
|
|
|
76
86
|
}
|
|
77
87
|
]
|
|
78
88
|
}
|
|
89
|
+
],
|
|
90
|
+
"UserPromptSubmit": [
|
|
91
|
+
{
|
|
92
|
+
"hooks": [
|
|
93
|
+
{
|
|
94
|
+
"type": "command",
|
|
95
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/handlers/user-prompt-submit.mjs\""
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"ConfigChange": [
|
|
101
|
+
{
|
|
102
|
+
"hooks": [
|
|
103
|
+
{
|
|
104
|
+
"type": "command",
|
|
105
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/handlers/config-change.mjs\""
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"InstructionsLoaded": [
|
|
111
|
+
{
|
|
112
|
+
"hooks": [
|
|
113
|
+
{
|
|
114
|
+
"type": "command",
|
|
115
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/handlers/compact-lifecycle.mjs\" --phase=instructions"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
"SessionEnd": [
|
|
121
|
+
{
|
|
122
|
+
"hooks": [
|
|
123
|
+
{
|
|
124
|
+
"type": "command",
|
|
125
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/handlers/stop-gate.mjs\" --phase=end"
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
79
129
|
]
|
|
80
130
|
}
|
|
81
131
|
}
|
package/hooks/post_tool_use.mjs
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { runStrictPostToolUse } from '../src/hooks/portfolio_runtime.mjs';
|
|
3
3
|
import { readStdinSafe } from '../src/hooks/post_invocation.mjs';
|
|
4
|
+
import { handleAntigravityRslHook } from '../src/hooks/antigravity_rsl_hook.mjs';
|
|
4
5
|
|
|
5
6
|
readStdinSafe({ maxTimeoutMs: 250, settleMs: 2 })
|
|
6
7
|
.then(async (input) => {
|
|
8
|
+
if (input?.workspacePaths?.[0] || input?.cwd) {
|
|
9
|
+
try {
|
|
10
|
+
handleAntigravityRslHook(input, { event: 'PostToolUse' });
|
|
11
|
+
} catch {
|
|
12
|
+
// Fail open for RSL step telemetry
|
|
13
|
+
}
|
|
14
|
+
}
|
|
7
15
|
await runStrictPostToolUse(input);
|
|
8
16
|
return {};
|
|
9
17
|
})
|
package/hooks/register.js
CHANGED
|
@@ -165,12 +165,29 @@ function shouldClearRecentEditsOnToolEvent(event) {
|
|
|
165
165
|
const cmd = String(input.command || input.cmd || event?.command || '');
|
|
166
166
|
return (
|
|
167
167
|
/\bgit\s+commit\b/i.test(cmd) ||
|
|
168
|
-
/\b(?:npm\s+test|npm\s+run\s+test|pnpm\s+test|yarn\s+test|bun\s+test|vitest|jest|pytest|cargo\s+test|go\s+test|node\s+--test)\b/i.test(
|
|
168
|
+
/\b(?:npm\s+test|npm\s+run\s+test|pnpm\s+(?:run\s+)?test|yarn\s+test|bun\s+test|vitest|jest|pytest|cargo\s+test|go\s+test|node\s+--test|tsc(?:\s|$)|npx\s+tsc)\b/i.test(
|
|
169
169
|
cmd
|
|
170
170
|
)
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
function didDownstreamToolResultFail(result) {
|
|
175
|
+
if (!result || typeof result !== 'object') return false;
|
|
176
|
+
if (
|
|
177
|
+
result.is_error === true ||
|
|
178
|
+
result.isError === true ||
|
|
179
|
+
result.succeeded === false ||
|
|
180
|
+
result.status === 'error' ||
|
|
181
|
+
result.status === 'failed' ||
|
|
182
|
+
Boolean(result.error)
|
|
183
|
+
) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
if (typeof result.exit_code === 'number' && result.exit_code !== 0) return true;
|
|
187
|
+
if (typeof result.exitCode === 'number' && result.exitCode !== 0) return true;
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
|
|
174
191
|
/**
|
|
175
192
|
* Main Mod registration function.
|
|
176
193
|
* @param {Function} on - Claude Code event registration callback
|
|
@@ -255,19 +272,18 @@ export default function register(on) {
|
|
|
255
272
|
};
|
|
256
273
|
}
|
|
257
274
|
|
|
258
|
-
|
|
275
|
+
const isEditEvent = isWorkspaceEditToolEvent(event);
|
|
276
|
+
const isClearCandidate = !isEditEvent && shouldClearRecentEditsOnToolEvent(event);
|
|
277
|
+
if (isEditEvent) {
|
|
259
278
|
ttlWatchdog.recordFileChanged(extractModEventFilePath(event), Date.now());
|
|
260
279
|
$.store.set('ah_recent_file_changed', true);
|
|
261
280
|
$.store.set('ah_turn_mutations', (Number($.store.get('ah_turn_mutations')) || 0) + 1);
|
|
262
|
-
} else if (shouldClearRecentEditsOnToolEvent(event)) {
|
|
263
|
-
ttlWatchdog.clearRecentEdits();
|
|
264
|
-
$.store.set('ah_recent_file_changed', false);
|
|
265
|
-
$.store.set('ah_turn_mutations', (Number($.store.get('ah_turn_mutations')) || 0) + 1);
|
|
266
281
|
}
|
|
267
282
|
|
|
268
283
|
let repeatReadAdvisory = '';
|
|
269
284
|
const tName = String(event?.tool_name || event?.toolName || '');
|
|
270
285
|
const tArgs = event?.tool_input || event?.toolInput || {};
|
|
286
|
+
const cmdStr = String(tArgs.command || tArgs.cmd || event?.command || '');
|
|
271
287
|
if (
|
|
272
288
|
activeMode !== 'OFF' &&
|
|
273
289
|
/^(Read|read_file)$/i.test(tName) &&
|
|
@@ -287,15 +303,37 @@ export default function register(on) {
|
|
|
287
303
|
}
|
|
288
304
|
}
|
|
289
305
|
|
|
306
|
+
const finalizeDownstream = async () => {
|
|
307
|
+
const downstream = typeof next === 'function' ? await next(event) : undefined;
|
|
308
|
+
const failed = didDownstreamToolResultFail(downstream);
|
|
309
|
+
if (isClearCandidate && !failed) {
|
|
310
|
+
ttlWatchdog.clearRecentEdits();
|
|
311
|
+
$.store.set('ah_recent_file_changed', false);
|
|
312
|
+
$.store.set('ah_turn_mutations', (Number($.store.get('ah_turn_mutations')) || 0) + 1);
|
|
313
|
+
}
|
|
314
|
+
if (/^(bash|powershell|pwsh|cmd|sh)$/i.test(tName)) {
|
|
315
|
+
const outText =
|
|
316
|
+
typeof downstream === 'string'
|
|
317
|
+
? downstream
|
|
318
|
+
: String(downstream?.stderr || downstream?.stdout || downstream?.output || '');
|
|
319
|
+
breakerEngine.recordVerificationOutcome({
|
|
320
|
+
succeeded: !failed,
|
|
321
|
+
command: cmdStr,
|
|
322
|
+
outputText: outText
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
return downstream;
|
|
326
|
+
};
|
|
327
|
+
|
|
290
328
|
if (verdict.triggered) {
|
|
291
329
|
$.store.set('ah_last_breaker_verdict', verdict);
|
|
292
330
|
$.ui.invalidate('ui.render');
|
|
293
|
-
const downstream =
|
|
331
|
+
const downstream = await finalizeDownstream();
|
|
294
332
|
return downstream ?? { additionalContext: verdict.reason };
|
|
295
333
|
}
|
|
296
334
|
|
|
297
335
|
if (repeatReadAdvisory) {
|
|
298
|
-
const downstream =
|
|
336
|
+
const downstream = await finalizeDownstream();
|
|
299
337
|
if (downstream && typeof downstream === 'object') {
|
|
300
338
|
return {
|
|
301
339
|
...downstream,
|
|
@@ -308,8 +346,9 @@ export default function register(on) {
|
|
|
308
346
|
}
|
|
309
347
|
|
|
310
348
|
if (typeof next === 'function') {
|
|
311
|
-
return await
|
|
349
|
+
return await finalizeDownstream();
|
|
312
350
|
}
|
|
351
|
+
await finalizeDownstream();
|
|
313
352
|
return undefined;
|
|
314
353
|
})
|
|
315
354
|
.catch((err) => {
|
package/hooks/session_start.mjs
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { handleSessionStart } from '../src/hooks/session_start.mjs';
|
|
3
3
|
import { readStdinSafe } from '../src/hooks/post_invocation.mjs';
|
|
4
|
+
import { handleAntigravityRslHook } from '../src/hooks/antigravity_rsl_hook.mjs';
|
|
4
5
|
|
|
5
6
|
readStdinSafe()
|
|
6
|
-
.then((input) =>
|
|
7
|
+
.then((input) => {
|
|
8
|
+
if (input?.workspacePaths?.[0] || input?.cwd) {
|
|
9
|
+
try {
|
|
10
|
+
handleAntigravityRslHook(input, { event: 'SessionStart' });
|
|
11
|
+
} catch {
|
|
12
|
+
// Fail open for RSL baseline
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return handleSessionStart(input);
|
|
16
|
+
})
|
|
7
17
|
.then((out) => {
|
|
8
18
|
process.stdout.write(JSON.stringify(out && typeof out === 'object' ? out : {}) + '\n');
|
|
9
19
|
process.exit(0);
|
package/hooks/stop.mjs
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { handlePostInvocation, readStdinSafe } from '../src/hooks/post_invocation.mjs';
|
|
3
|
+
import { handleAntigravityRslHook } from '../src/hooks/antigravity_rsl_hook.mjs';
|
|
3
4
|
|
|
4
5
|
readStdinSafe({ maxTimeoutMs: 500, settleMs: 15 })
|
|
5
|
-
.then((input) =>
|
|
6
|
+
.then(async (input) => {
|
|
7
|
+
if (input?.workspacePaths?.[0] || input?.cwd) {
|
|
8
|
+
try {
|
|
9
|
+
handleAntigravityRslHook(input, { event: 'Stop' });
|
|
10
|
+
} catch {
|
|
11
|
+
// Fail open for RSL post-mortem
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return handlePostInvocation({ ...input, hook_event_name: 'Stop' });
|
|
15
|
+
})
|
|
6
16
|
.then(() => {
|
|
7
17
|
process.stdout.write('{}\n');
|
|
8
18
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ctxtop",
|
|
3
3
|
"displayName": "Highbeam",
|
|
4
|
-
"version": "4.
|
|
5
|
-
"description": "Highbeam v4.
|
|
4
|
+
"version": "4.1.0",
|
|
5
|
+
"description": "Highbeam v4.1: Cross-platform AI Developer Assistant Extension for Google Antigravity and Claude Code: 40-cell context visualizer, KV-cache gravity router, and zero-token guardrails.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"workspaces": [
|
|
8
8
|
"packages/core",
|
|
@@ -45,7 +45,12 @@
|
|
|
45
45
|
"rules/",
|
|
46
46
|
"skills/",
|
|
47
47
|
"sidecars/",
|
|
48
|
-
"packages/",
|
|
48
|
+
"packages/core/",
|
|
49
|
+
"packages/engine-node/",
|
|
50
|
+
"packages/antigravity/",
|
|
51
|
+
"packages/claude-code/",
|
|
52
|
+
"packages/pro/",
|
|
53
|
+
"packages/mcp/",
|
|
49
54
|
"src/"
|
|
50
55
|
],
|
|
51
56
|
"scripts": {
|
|
@@ -61,6 +66,7 @@
|
|
|
61
66
|
"build:assets": "node --no-warnings scripts/generate_hero_svg.mjs && node --no-warnings scripts/build_demo_page.mjs",
|
|
62
67
|
"build:release": "node scripts/build_release_bundle.mjs",
|
|
63
68
|
"test": "npm run test:unit && npm run test:coach && npm run test:gates && npm run test:phases",
|
|
69
|
+
"test:airlock": "node --test packages/airlock/test/airlock_standalone_proofs.test.mjs",
|
|
64
70
|
"test:unit": "node --test tests/test_router_and_sensors.mjs tests/test_wave1_wedge.mjs tests/test_wave2_wedge.mjs tests/test_wave3_wedge.mjs tests/test_carbon_swarm_patch.mjs tests/test_concurrency.mjs tests/test_postmortem_features.mjs tests/test_schema_drift.mjs tests/test_mirror_boot_smoke.mjs && node tests/test_regressions.cjs",
|
|
65
71
|
"test:coach": "node --test test/all.test.mjs",
|
|
66
72
|
"test:claude": "node --test test/claude-code/*.test.mjs",
|
|
@@ -69,7 +75,8 @@
|
|
|
69
75
|
"test:e2e": "node tests/verify_e2e_context_memory.mjs",
|
|
70
76
|
"bench": "node tests/bench_latency.mjs",
|
|
71
77
|
"bench:scenario": "node --no-warnings tests/benchmark_context_scenario.mjs",
|
|
72
|
-
"bench:composite": "node scripts/run_composite_benchmarks.mjs"
|
|
78
|
+
"bench:composite": "node scripts/run_composite_benchmarks.mjs",
|
|
79
|
+
"bench:bucket-b": "node scripts/run_bucket_b_harness.mjs"
|
|
73
80
|
},
|
|
74
81
|
"repository": {
|
|
75
82
|
"type": "git",
|
package/plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://antigravity.google/schemas/v1/plugin.json",
|
|
3
3
|
"name": "attention-horizon-antigravity",
|
|
4
4
|
"displayName": "Highbeam",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.1.0",
|
|
6
6
|
"description": "40-cell chronological context telemetry HUD, KV-Cache Gravity effort router, and zero-token guardrails.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Gizzant"
|
|
@@ -22,6 +22,7 @@ import { getFlightcheckDir } from '../../src/core/sidecar_store.mjs';
|
|
|
22
22
|
import { PrefixCacheShield } from '../../src/core/prefix_cache_shield.mjs';
|
|
23
23
|
import { CompactionCoach, assessCompactionState, trimUncachedTail } from '../../src/core/compaction_coach.mjs';
|
|
24
24
|
import { RsiInstinctEngine } from '../../src/core/rsi_instinct_engine.mjs';
|
|
25
|
+
import { getRslSummary } from '../../src/core/rsl_ledger.mjs';
|
|
25
26
|
import { UShapedAttentionOptimizer } from '../../src/core/u_shaped_optimizer.mjs';
|
|
26
27
|
import {
|
|
27
28
|
evaluateTaskAndQuotaRoute,
|
|
@@ -57,6 +58,7 @@ import {
|
|
|
57
58
|
activateLocalTrial
|
|
58
59
|
} from '../../src/core/pro_license.mjs';
|
|
59
60
|
import { generateCorporateExpenseReceipt } from '../../src/core-isomorphic/ui/pdfReceiptGenerator.mjs';
|
|
61
|
+
import { DETECTOR_CATALOG } from '../../src/core-isomorphic/catalog/detectorCatalog.mjs';
|
|
60
62
|
import { ProgressiveCheckpointer } from '../../src/core/coach/progressive_checkpointer.mjs';
|
|
61
63
|
import { atomicWriteFileSync } from '../../src/core/atomic_io.mjs';
|
|
62
64
|
import { MicroIpcServer } from '../../src/engine-node/ipc/server.mjs';
|
|
@@ -483,12 +485,20 @@ function buildCoachState(state, targetConvId) {
|
|
|
483
485
|
});
|
|
484
486
|
}
|
|
485
487
|
const primaryTripped = combinedAlerts.length > 0 ? combinedAlerts[combinedAlerts.length - 1] : null;
|
|
488
|
+
const trippedIds = new Set(combinedAlerts.map((a) => a.detectorId));
|
|
489
|
+
const cfgDetectors = horizonCfg?.detectors || {};
|
|
490
|
+
const guardList = Object.values(DETECTOR_CATALOG).map((meta) => {
|
|
491
|
+
const cfgMode = String(cfgDetectors[meta.id] || 'default').toLowerCase();
|
|
492
|
+
const mode = cfgMode === 'default' ? String(meta.defaultMode || 'advisory') : cfgMode;
|
|
493
|
+
return { id: meta.id, name: meta.name, mode, severity: meta.severity || 'WARN', tripped: trippedIds.has(meta.id) };
|
|
494
|
+
}).filter((g) => g.mode !== 'off');
|
|
486
495
|
|
|
487
496
|
return {
|
|
488
497
|
prefixCacheShield: shieldStatus,
|
|
489
498
|
detectors: {
|
|
490
499
|
active: true,
|
|
491
|
-
totalCount:
|
|
500
|
+
totalCount: guardList.length,
|
|
501
|
+
list: guardList,
|
|
492
502
|
tripped: primaryTripped
|
|
493
503
|
? {
|
|
494
504
|
detectorId: primaryTripped.detectorId,
|
|
@@ -500,7 +510,7 @@ function buildCoachState(state, targetConvId) {
|
|
|
500
510
|
: null,
|
|
501
511
|
summary: combinedAlerts.length > 0
|
|
502
512
|
? `${combinedAlerts.length} breaker${combinedAlerts.length === 1 ? '' : 's'} tripped (${combinedAlerts.map(a => a.detectorId).join(', ')})`
|
|
503
|
-
:
|
|
513
|
+
: `${guardList.length} guards quiet`
|
|
504
514
|
},
|
|
505
515
|
scopeCollision: scopeCollisionAlert,
|
|
506
516
|
thinkingDrift,
|
|
@@ -561,6 +571,32 @@ function buildCoachState(state, targetConvId) {
|
|
|
561
571
|
};
|
|
562
572
|
}
|
|
563
573
|
})(),
|
|
574
|
+
rsl: (() => {
|
|
575
|
+
try {
|
|
576
|
+
const rslSummary = getRslSummary(wsDir);
|
|
577
|
+
if (state && typeof state === 'object') {
|
|
578
|
+
state.rsl = rslSummary;
|
|
579
|
+
const telDir = path.join(wsDir, '.agents', 'telemetry');
|
|
580
|
+
let shardCount = Array.isArray(state.sessionMeta?.specShards) ? state.sessionMeta.specShards.length : 0;
|
|
581
|
+
if (shardCount === 0 && fs.existsSync(telDir)) {
|
|
582
|
+
const pFiles = fs.readdirSync(telDir).filter((n) => n.startsWith('prompt_state.') && n.endsWith('.json'));
|
|
583
|
+
for (const pf of pFiles.slice(0, 3)) {
|
|
584
|
+
try {
|
|
585
|
+
const ps = JSON.parse(fs.readFileSync(path.join(telDir, pf), 'utf8'));
|
|
586
|
+
shardCount = Math.max(shardCount, Array.isArray(ps?.specShards) ? ps.specShards.length : 0);
|
|
587
|
+
} catch (parseErr) {
|
|
588
|
+
recordDaemonDiagnostic('buildCoachState:promptState', parseErr);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
state.shardedSpecCount = shardCount;
|
|
593
|
+
}
|
|
594
|
+
return rslSummary;
|
|
595
|
+
} catch (err) {
|
|
596
|
+
if (err?.code !== 'ENOENT') recordDaemonDiagnostic('buildCoachState:rsl', err);
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
599
|
+
})(),
|
|
564
600
|
taskQuotaRouter: taskRoute
|
|
565
601
|
};
|
|
566
602
|
} catch (err) {
|
package/skills/handoff/SKILL.md
CHANGED
|
@@ -40,3 +40,11 @@ When writing or updating `task.md`, apply the **KEEP / DROP** filter:
|
|
|
40
40
|
```
|
|
41
41
|
3. When the audit reports `CLEAN ✅` and the KV cache window is ready, advise the user with the parameterized compaction prompt:
|
|
42
42
|
> Type `/compact` in the chat box and press Enter (preserving active exported symbols, `task.md` checklist state, and explicit in-chat constraints).
|
|
43
|
+
|
|
44
|
+
## Consolidating Sharded Specifications (`[CTX_HINT: SHARDED_SPEC]`)
|
|
45
|
+
|
|
46
|
+
When multi-turn requirement sharding triggers (`4+` incremental constraint turns across `>=25k` tokens), merge scattered Turn-1 goals, recorded shards, and uncommitted paths into a clean restart contract before clearing:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx ctxtop handoff --consolidate --write
|
|
50
|
+
```
|
|
@@ -47,8 +47,28 @@ import {
|
|
|
47
47
|
writeSidecarAtomicSync,
|
|
48
48
|
updateSwarmAgentStateAtomicSync
|
|
49
49
|
} from '../../core/sidecar_store.mjs';
|
|
50
|
+
import { checkIndex, buildIndex, sliceFile } from '../../core/doc_indexer.mjs';
|
|
51
|
+
import {
|
|
52
|
+
evaluateShieldReadGuard,
|
|
53
|
+
configureShield,
|
|
54
|
+
getShieldStatus
|
|
55
|
+
} from '../../core/shield_manager.mjs';
|
|
56
|
+
import { runSessionAudit, formatSessionAuditReport } from '../../core/session_auditor.mjs';
|
|
57
|
+
import {
|
|
58
|
+
resolveModelCliffSpec,
|
|
59
|
+
evaluateParameterizedCliffBreaker
|
|
60
|
+
} from '../../core-isomorphic/economics/cliffBreaker.mjs';
|
|
61
|
+
import {
|
|
62
|
+
handleAntigravityRslHook,
|
|
63
|
+
syncAntigravityWorkspaceRslHooks
|
|
64
|
+
} from '../../hooks/antigravity_rsl_hook.mjs';
|
|
65
|
+
export * from '../../core/rsl_triage.mjs';
|
|
66
|
+
export * from '../../core/rsl_distiller.mjs';
|
|
67
|
+
export * from '../../core/rsl_ledger.mjs';
|
|
50
68
|
|
|
51
69
|
export {
|
|
70
|
+
handleAntigravityRslHook,
|
|
71
|
+
syncAntigravityWorkspaceRslHooks,
|
|
52
72
|
handlePreInvocation,
|
|
53
73
|
handlePreToolUse,
|
|
54
74
|
handlePostInvocation,
|
|
@@ -75,5 +95,15 @@ export {
|
|
|
75
95
|
evaluateCarbonVerbosityGuardrail,
|
|
76
96
|
readSidecarSync,
|
|
77
97
|
writeSidecarAtomicSync,
|
|
78
|
-
updateSwarmAgentStateAtomicSync
|
|
98
|
+
updateSwarmAgentStateAtomicSync,
|
|
99
|
+
checkIndex,
|
|
100
|
+
buildIndex,
|
|
101
|
+
sliceFile,
|
|
102
|
+
evaluateShieldReadGuard,
|
|
103
|
+
configureShield,
|
|
104
|
+
getShieldStatus,
|
|
105
|
+
resolveModelCliffSpec,
|
|
106
|
+
evaluateParameterizedCliffBreaker,
|
|
107
|
+
runSessionAudit,
|
|
108
|
+
formatSessionAuditReport
|
|
79
109
|
};
|
|
@@ -141,7 +141,32 @@ export function trackClaudeCodeSessionCache(events = [], options = {}) {
|
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
import { checkIndex, buildIndex, sliceFile } from '../../core/doc_indexer.mjs';
|
|
145
|
+
import {
|
|
146
|
+
evaluateShieldReadGuard,
|
|
147
|
+
configureShield,
|
|
148
|
+
getShieldStatus,
|
|
149
|
+
syncClaudeIdleDrainSettings,
|
|
150
|
+
auditClaudeIdleDrainSettings,
|
|
151
|
+
auditClaudeAgentAutoCompactWindows
|
|
152
|
+
} from '../../core/shield_manager.mjs';
|
|
153
|
+
import { runSessionAudit, formatSessionAuditReport } from '../../core/session_auditor.mjs';
|
|
154
|
+
import {
|
|
155
|
+
resolveModelCliffSpec,
|
|
156
|
+
evaluateParameterizedCliffBreaker
|
|
157
|
+
} from '../../core-isomorphic/economics/cliffBreaker.mjs';
|
|
158
|
+
import { runConfigChangeHook } from '../../../hooks/handlers/config-change.mjs';
|
|
159
|
+
import {
|
|
160
|
+
handleClaudeRslHook,
|
|
161
|
+
syncClaudeWorkspaceRslHooks
|
|
162
|
+
} from '../../hooks/claude_rsl_hook.mjs';
|
|
163
|
+
export * from '../../core/rsl_triage.mjs';
|
|
164
|
+
export * from '../../core/rsl_distiller.mjs';
|
|
165
|
+
export * from '../../core/rsl_ledger.mjs';
|
|
166
|
+
|
|
144
167
|
export {
|
|
168
|
+
handleClaudeRslHook,
|
|
169
|
+
syncClaudeWorkspaceRslHooks,
|
|
145
170
|
formatAgentCacheKey,
|
|
146
171
|
formatAgentStreamKey,
|
|
147
172
|
parseAgentCacheKey,
|
|
@@ -151,5 +176,19 @@ export {
|
|
|
151
176
|
computeQuotaAndCacheTelemetry,
|
|
152
177
|
resolveModelDescriptor,
|
|
153
178
|
resolveModelRates,
|
|
154
|
-
calculateModelCost
|
|
179
|
+
calculateModelCost,
|
|
180
|
+
checkIndex,
|
|
181
|
+
buildIndex,
|
|
182
|
+
sliceFile,
|
|
183
|
+
evaluateShieldReadGuard,
|
|
184
|
+
configureShield,
|
|
185
|
+
getShieldStatus,
|
|
186
|
+
syncClaudeIdleDrainSettings,
|
|
187
|
+
auditClaudeIdleDrainSettings,
|
|
188
|
+
auditClaudeAgentAutoCompactWindows,
|
|
189
|
+
resolveModelCliffSpec,
|
|
190
|
+
evaluateParameterizedCliffBreaker,
|
|
191
|
+
runConfigChangeHook,
|
|
192
|
+
runSessionAudit,
|
|
193
|
+
formatSessionAuditReport
|
|
155
194
|
};
|