Commit graph

91 commits

Author SHA1 Message Date
Tejas Chopra
80cfcd7e5b
Merge pull request #192 from JerrettDavis/feature/spec-183
feat(specs): #183 scaffold initial application specs.
2026-04-17 11:00:33 -07:00
JerrettDavis
bde7aa9c30 fix: align docker image versions with releases
Derive the exact Docker image version from the release tag or manual
workflow input, sync versioned files in the build workspace before the
image build, and publish an explicit matching image tag.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-17 12:17:49 -05:00
JerrettDavis
8872b8be3b fix: take highest release bump across unreleased commits
Determine the release bump from all unreleased commits since the previous
release tag and apply the highest required semantic version increment.
This keeps feat commits at a minor bump unless a breaking change requires
major, even when later patch-level commits are present.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 23:38:29 -05:00
JerrettDavis
ec305efcd9 docs: move spec from specify/ to docs/spec/
Align with SpecKit's canonical docs/ structure. Update .gitignore
comment to reflect new location.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-16 21:15:04 -05:00
JerrettDavis
1192f657eb docs: document HEADROOM_CONFIG_DIR / HEADROOM_WORKSPACE_DIR filesystem contract
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-16 19:24:17 -05:00
JerrettDavis
0ba104248c fix: repair release and docs pipelines
Grant the release job contents write permission so GitHub releases can be created, and add the missing docs/overrides directory required by MkDocs deployment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-16 12:53:51 -05:00
JerrettDavis
049b3527a8 refactor: implement canonical+commit-height release algorithm
The release workflow now uses a loop-free algorithm:
- pyproject.toml is the canonical source of truth (never committed by workflow)
- Git tags use v{canonical}.{height} format (e.g. v0.5.25.3)
- npm publishes use 3-part semver bumped from canonical
- No commit step eliminates infinite release loops
- paths-ignore reduces unnecessary workflow triggers

Also:
- Add .releaseetadata to .gitignore
- Separate npm_version output for semver-compatible npm publishing
- create-release no longer blocks on publish jobs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 21:26:13 -05:00
JerrettDavis
2df4a53be4 docs: add releases & CI/CD documentation 2026-04-15 20:33:06 -05:00
Tejas Chopra
54ae7b9928
Merge pull request #147 from JerrettDavis/feat/anthropic-usage-insights
feat: AI quota & rate-limit tracking — Anthropic, OpenAI Codex, and GitHub Copilot
2026-04-12 10:54:22 -07:00
Adib Mohsin
ef23064358 tokens saved grid 2026-04-12 13:42:20 +06:00
Adib Mohsin
911eb85a44 new docs UI + ts doc coverage 2026-04-12 13:15:58 +06:00
JerrettDavis
788d0e7265 feat(dashboard): expand Codex and Copilot cards to match Anthropic card layout
- Codex: 2-column Primary/Secondary window grid (h-3 bars, window labels,
  reset countdowns); Credits moved to bordered section like Anthropic
  extra-usage panel
- Copilot: 3-column category grid (Chat/Completions/Premium) with big
  used/entitlement numbers, color-coded % bars, overage-permitted status
  per category; Monthly Reset section with month-elapsed progress bar and
  formatMonthlyReset() helper
- All three provider cards now share consistent visual language:
  uppercase section labels, h-3 progress bars, border-t dividers

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-12 00:20:10 -05:00
JerrettDavis
d11feea511 feat: add GitHub Copilot monthly quota tracking
Adds passive tracking of GitHub Copilot per-category monthly quotas
(chat, completions, premium_interactions) via GET /copilot_internal/user
on api.github.com.

Token discovery checks environment variables in priority order:
  GITHUB_COPILOT_GITHUB_TOKEN > GITHUB_TOKEN >
  COPILOT_GITHUB_TOKEN > GITHUB_COPILOT_API_TOKEN

- headroom/subscription/copilot_quota.py: CopilotQuotaCategory,
  CopilotQuotaSnapshot, CopilotQuotaState, parse_copilot_quota(),
  discover_github_token(), _CopilotQuotaTracker singleton (60s poll)
- headroom/subscription/__init__.py: export new symbols
- headroom/proxy/server.py: start/stop tracker in lifecycle;
  _get_copilot_quota_stats(); copilot_quota key in /stats
- dashboard.html: GitHub Copilot Quota panel with per-category
  progress bars, remaining counts, overage alerts, reset date
- tests/test_copilot_quota.py: 25 unit tests (all pass)
- docs/screenshots/subscription_window_active.png: updated to show
  all three panels (Anthropic + Codex + GitHub Copilot)

Env vars sourced from @github/copilot v1.0.24 app.js (k6e array).
API schema sourced from copilot_internal/user via eBo/QRt zod schemas.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 23:58:44 -05:00
JerrettDavis
a3abbec4a3 feat: add OpenAI Codex rate-limit window tracking
Passively capture x-codex-* response headers from proxied Codex API
calls and surface them in /stats and the dashboard.

Unlike Anthropic subscription window tracking (which polls a dedicated
OAuth endpoint), Codex embeds rate-limit data directly in every API
response header — no polling, no new credentials needed.

Changes:
- headroom/subscription/codex_rate_limits.py: new module with
  CodexRateLimitWindow, CodexCreditsSnapshot, CodexRateLimitSnapshot
  data models and a thread-safe CodexRateLimitState singleton;
  parse_codex_rate_limits() parses x-codex-primary/secondary-used-percent,
  window-minutes, reset-at, credits, limit-name, and promo-message headers
- headroom/subscription/__init__.py: re-export new public symbols
- headroom/proxy/handlers/openai.py: call
  get_codex_rate_limit_state().update_from_headers() after each
  proxied /v1/chat/completions and /v1/responses response
- headroom/proxy/server.py: add codex_rate_limits key to /stats
  via _get_codex_rate_limit_stats() helper
- headroom/dashboard/templates/dashboard.html: new OpenAI Codex
  Rate-Limit Window panel (primary + secondary progress bars, credits
  balance, limit name, reset countdown); hidden when no data
- tests/test_codex_rate_limits.py: 25 unit tests covering parsing,
  window labels, reset time, credits, state updates
- docs/screenshots/subscription_window_active.png: updated screenshot
  showing both Anthropic and Codex panels in the real dashboard

Header schema (from codex-rs/codex-api/src/rate_limits.rs):
  x-codex-primary-used-percent / x-codex-primary-window-minutes /
  x-codex-primary-reset-at  (and secondary- variants)
  x-codex-credits-has-credits / -unlimited / -balance
  x-codex-limit-name / x-codex-promo-message

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 23:34:19 -05:00
JerrettDavis
86efb59615 docs: replace mock screenshots with real dashboard renders
Active state shows the full headroom dashboard with the Anthropic
Subscription Window panel integrated in-line after Savings Breakdown,
including 5h/7d utilisation bars, overage credit bar, Headroom
contribution grid, and anomaly detection alert.

Inactive state shows the standard dashboard without the panel —
it is conditionally rendered only when subscription_window data
is present in /stats.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 22:30:43 -05:00
JerrettDavis
958c731e75 docs: add dashboard screenshots for subscription window panel
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 21:58:28 -05:00
JerrettDavis
865bef2216 fix: harden persistent install wrappers and review gaps
Align Docker-native wrapper help and runtime behavior with the Python install contract, including persistent deployment metadata, baked install-image defaults, and explicit unsupported wrap targets.

Harden the Python persistent-install path with profile validation, safer provider-scope handling, Windows environment restoration, runtime parity improvements, and rollback-safe apply/update behavior.

Update README, Docker install docs, CI, and focused regressions to cover the Windows BOM failure, wrapper parity, compose coverage, and Docker-native wrap behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 18:03:21 -05:00
JerrettDavis
b325a06aae feat: harden persistent install wrappers
Tighten Docker-native bash and PowerShell wrapper validation for wrap and proxy flows, pin the bash wrapper to the install-time interpreter, clean up failed persistent container starts, and extend docs, CI, e2e, and native installer coverage for persistent Docker installs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 15:56:18 -05:00
JerrettDavis
21896a095c feat: add persistent install lifecycle management
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 13:47:05 -05:00
Tejas Chopra
a245234f5a
Merge pull request #130 from Gyeonghun-Park/feat/cli-llm-backend
feat(learn): add CLI-based LLM backends for keyless headroom learn
2026-04-11 09:05:26 -07:00
Tejas Chopra
9f124c99ff
Merge pull request #139 from JerrettDavis/feat/docker-native-cli
feat(cli): add Docker-native install flow and parity docs
2026-04-11 09:05:00 -07:00
JerrettDavis
9fa1763087 feat: add copilot CLI wrap support
Add headroom wrap copilot with backend-aware provider routing, health metadata for running proxy detection, focused Copilot tests, and docs updates across the main integration surfaces.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 01:20:17 -05:00
JerrettDavis
777faa85a7 docs: fix CLI parity matrix table
Separate the Docker-native parity legend from the table header so Markdown renders the matrix correctly in cli.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 00:11:10 -05:00
JerrettDavis
a1dcda6bc4 feat(cli): support OpenClaw in Docker-native installs
Add host-managed OpenClaw wrap and unwrap flows to the Docker-native wrappers so the installed headroom script can configure the OpenClaw plugin on the host while keeping Headroom itself in Docker. Reuse hidden prepare-only hooks for OpenClaw config payloads, preserve existing plugin metadata on unwrap, and update the Docker-native and integration docs to reflect the supported flow.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-11 00:04:15 -05:00
JerrettDavis
38b1483a76 feat(cli): add Docker-native install flow and parity docs
Add system-native install scripts and host wrappers for running Headroom from Docker while keeping wrapped tools on the host. Document the Docker-native path, add a complete CLI reference with help output and parity details, and add support for root help/version aliases and proxy env-based binding behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-10 23:27:24 -05:00
Gyeonghun Park
da4b971128 Merge remote-tracking branch 'origin/main' into feat/cli-llm-backend
# Conflicts:
#	docs/learn.md
2026-04-11 10:05:45 +09:00
Tejas Chopra
5b81395511
Merge pull request #132 from JerrettDavis/jd/devcontainers
feat: add reproducible devcontainers
2026-04-10 14:54:27 -07:00
chopratejas
dd488fdaaf Update docs: cross-agent memory, plugin learn architecture, dedup
README.md:
- Add cross-agent memory section with --memory flag examples
- Update learn section with multi-agent support (Claude, Codex, Gemini)
- Update features table: memory now cross-agent, learn now plugin-based
- Add --memory to wrap examples

docs/memory.md:
- Add "Cross-Agent Memory (Proxy)" section with architecture diagram
- Document project-scoped DB, auto user_id, agent provenance
- Document intelligent dedup (enriched hints + async background)
- Document supported providers table (Anthropic, OpenAI, Gemini)
- Update comparison table with new features vs Mem0/Letta

docs/learn.md:
- Replace scanner/analyzer architecture with plugin system diagram
- Document plugin-based architecture (auto-discovery + entry points)
- Add supported agents table (Claude, Codex, Gemini + output files)
- Update CLI reference (--agent, --model flags)
- Fix "Where Learnings Go" table for multi-agent output
2026-04-10 14:46:46 -07:00
JerrettDavis
7a18b71c0d feat: add proxy healthcheck endpoints
Add /livez and /readyz, keep /health backward-compatible, and wire readiness into Docker artifacts and docs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-10 12:23:23 -05:00
Gyeonghun Park
e98c975153 feat(learn): add CLI-based LLM backends for keyless headroom learn
Allow `headroom learn` to use locally installed coding agent CLIs
(claude, gemini, codex) as LLM backends, so subscription users
without raw API keys can run failure analysis.

Priority: --model flag > API key > HEADROOM_LEARN_CLI env var > auto-detect

- Pass prompts via stdin to avoid ARG_MAX limits
- Handle TimeoutExpired, truncate stderr, enrich JSONDecodeError
- Add 31 new tests (48 total), all passing
- Update docs/learn.md with CLI backend documentation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 22:02:06 +09:00
JerrettDavis
be6aa14110 feat: expose proxy OTEL metrics and Langfuse status
Wire the proxy's operational metrics facade into the new observability
layer, expand built-in Prometheus export, surface OTEL and Langfuse status
in /stats, and document the split between anonymous telemetry, OTEL metrics,
and Langfuse traces.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-09 21:20:46 -05:00
JerrettDavis
4226372b15 Add dashboard screenshots for cache TTL metrics PR 2026-04-06 21:52:09 -05:00
JerrettDavis
a6787556be Add observed cache TTL metrics and dashboard coverage 2026-04-06 21:13:30 -05:00
JerrettDavis
8e4d7759de Harden cache validation reporting and TTL analysis 2026-04-06 20:11:21 -05:00
JerrettDavis
5ffa77f4a3 Harden anthropic cache-mode replay stability 2026-04-05 16:11:39 -05:00
JerrettDavis
09829be0f4 Add memory-conscious Claude session benchmark harness 2026-04-04 21:19:40 -05:00
JerrettDavis
5a2f1aeb42 Clarify token vs cache run modes in docs 2026-04-04 15:03:23 -05:00
JerrettDavis
54419ad8b8 Rebrand proxy modes to token/cache and harden cache-mode stability 2026-04-04 14:32:07 -05:00
JerrettDavis
c5e3686c89 feat(cli): add one-command OpenClaw wrap bootstrap 2026-04-03 23:08:13 -05:00
chopratejas
4f2213b7a4 Update benchmarks with real production telemetry and compression data
- Added compression performance table (6 content types, 1-2ms latency)
- Added production telemetry: 52ms median overhead, 50K+ sessions
- Added pipeline step timing from real-world data
- Added fleet summary (249 instances, 1.4B tokens saved)
- Added honest Limitations section (what we don't compress)
- Removed stale multi-tool agent test (script missing)
2026-04-02 22:36:51 -07:00
Garm
dd509585b0 Merge remote-tracking branch 'origin/main' into feat/persist-savings-history 2026-03-31 10:57:36 +02:00
Garm
9a695249af feat: add historical rollups and exports 2026-03-31 10:25:45 +02:00
chopratejas
acf532bc55 Update Discord invite link across all docs 2026-03-30 22:04:05 -07:00
gglucass
165d3ca726
Merge branch 'main' into feat/persist-savings-history 2026-03-30 12:04:39 +02:00
Tejas Chopra
42ea085751
Merge pull request #60 from gglucass/feat/add-headroom-sdk
feat: allow overriding proxy telemetry sdk via HEADROOM_SDK
2026-03-29 18:21:13 -07:00
kunallohtia
9590dbc214 feat: add LangGraph compress_tool_messages node for ToolMessage compression 2026-03-29 17:11:15 -07:00
chopratejas
95f9e7a3e0 docs: add OpenClaw plugin to README, integration guide, index, and TS SDK docs 2026-03-29 00:02:05 -07:00
Garm
69080be966 feat: persist proxy savings history 2026-03-27 15:27:05 +01:00
Garm
8232e7822e feat: allow overriding proxy telemetry sdk via HEADROOM_SDK 2026-03-27 14:23:32 +01:00
chopratejas
72e65148d2 Add TypeScript SDK (headroom-ai npm package)
- New `compress()` function: HTTP client calling POST /v1/compress on the proxy
- HeadroomClient: reusable client with retry, fallback, auth support
- Vercel AI SDK adapter: headroomMiddleware() for wrapLanguageModel()
- OpenAI SDK adapter: withHeadroom() Proxy wrapper
- Anthropic SDK adapter: withHeadroom() Proxy wrapper
- Format converters: Vercel AI SDK ↔ OpenAI message format round-trip
- POST /v1/compress proxy endpoint: compression without LLM call
- 90 TypeScript tests (84 unit + 6 integration) + 9 Python tests
- Zero runtime dependencies, all framework peers optional
- Updated README, proxy docs, integration guide, and 6 other doc pages
- New docs/typescript-sdk.md with full SDK documentation
- Removed docs/superpowers/ from tracking (.gitignore)
2026-03-26 15:41:56 -07:00