8000 feat: activity history, costs and budgets by adeelahmad · Pull Request #114 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat: activity history, costs and budgets - #114

Merged
adeelahmad merged 7 commits into
mainfrom
claude/activity-history-budgets-3sllyj
Oct 4, 2026
Merged

adeelahmad merged 7 commits into
mainfrom
claude/activity-history-budgets-3sllyj

Conversation

@adeelahmad
@adeelahmad adeelahmad commented Oct 4, 2026 •
Copy link
Copy Markdown
Owner

Before: Lens had no way to see what a resource cost or did over time. Nothing could cap what a routine, pipeline, workflow or namespace spends.

After: every incoming request, outgoing call (models, embeddings, decisions, speech, notifications, tool HTTP), change and run is written to one activity ledger. Each entry is tagged with the resources it counts for.

  • Each routine, recording, job and namespace shows its own history and cost.
  • Lists of routines, pipelines, workflows and namespaces show this month's spend.
  • A cost marked ≈ is an estimate.

Budgets are off unless set. A budget can cap USD and/or tokens per run, day, week or month. Before a routine run or a job, Lens estimates the next run from the last 30 days.

  • A run that would go over is held until someone picks "run once" or "skip" (the default).
  • A budget can also be set to skip the run, or to let the decision model weigh it. The model lets a run go only when it is sure.
  • A periodic check warns once per period when a budget is near or over.

Model cost is set per model in Settings > telemetry prices: by input and output tokens, by time (per hour), or off. A model with no price isn't costed, so local models stay free by default.

How:

  • app/domain/activity.py holds the ledger, attribution scopes, request middleware and cost queries.
  • app/domain/budgets.py holds budgets, estimates, the pre-run check and the sweep.
  • The hooks are in telemetry, routines and jobs.
  • New endpoints are /activity*, /budgets*, POST /jobs/{id}/release and POST /routines/runs/{id}/decide.
  • The frontend uses a shared components/costs kit.
  • Docs are in docs/activity.md and docs/budgets.md.

Tests: the new tests are tests/api/test_activity.py and test_budgets.py. The full backend suite was run on the embedded engine and on a real SurrealDB 3.2.4 server. The only failures were the known environmental conversion and voice tests. Frontend checks (tsc, eslint, jest 654) pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AMq5CNuWmtn3Suj1EamYBT

claude added 2 commits October 4, 2026 09:32
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AMq5CNuWmtn3Suj1EamYBT
…nd routine runs

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AMq5CNuWmtn3Suj1EamYBT
@adeelahmad adeelahmad self-assigned this Oct 4, 2026
claude added 3 commits October 4, 2026 09:42
…ff by default)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AMq5CNuWmtn3Suj1EamYBT
…st and budget in views

Budgets are off unless set. Before a routine run or a job, Lens estimates
the next run from the last 30 days and holds, skips or lets the assistant
weigh a run that would go over. Held runs wait for a person to pick.
Lists and detail pages show spend (≈ marks estimates) and budget state.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AMq5CNuWmtn3Suj1EamYBT
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AMq5CNuWmtn3Suj1EamYBT
@adeelahmad adeelahmad changed the title feat(activity): every resource's activity history, with what it cost feat: activity history, costs and budgets Oct 4, 2026
claude added 2 commits October 4, 2026 12:18
Jev's call keeps its ledger row around main's shared _system_one; spoken answers
go through speech.speak with a model.speech row. A held routine run is released
only after its run is asked for, so a routine that is running stays held.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0