feat(telemetry): add local agent efficiency metrics

This commit is contained in:
Julian lechner committed 2026-09-17 08:32:39 +02:00
1 parent 4fa8708ba7
commit bdf98d5b71
5 files changed
+86 -14

No files matched your search

+6 -2
View File
@@ -2,7 +2,11 @@
param()
$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
$stateDir = Join-Path $root '.ai-session'
New-Item $stateDir -ItemType Directory -Force | Out-Null
('{"event":"compact","timestamp":"' + (Get-Date).ToUniversalTime().ToString('o') + '"}') | Add-Content (Join-Path $stateDir 'telemetry.jsonl')
if ($env:AI_CONFIG_TELEMETRY -ne '0') {
New-Item $stateDir -ItemType Directory -Force | Out-Null
$path = Join-Path $stateDir 'telemetry.jsonl'
('{"event":"compact","timestamp":"' + (Get-Date).ToUniversalTime().ToString('o') + '"}') | Add-Content $path
if ((Get-Item $path).Length -gt 1048576) { Move-Item $path ($path + '.1') -Force }
}
& python (Join-Path $PSScriptRoot 'session-state.py') --hook
exit $LASTEXITCODE