Repository navigation
Add comprehensive example agents for all supported integrations - #6
Merged
Merged
Conversation
16 runnable examples across 4 tiers: - single_provider: Anthropic, OpenAI, Gemini, Bedrock, OpenAI Agents SDK - single_framework: LangChain, LangGraph, CrewAI, AutoGen, LlamaIndex - multi: provider router, research team, RAG with fallback - alerts_and_drift: sensitive actions, budget breach, drift detection (no API keys) Also updates README.md (Examples section), CLAUDE.md (repo layout + rule 13 for PyPI package name), and adds the task spec. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Merged
This was referenced Jun 18, 2026
HoomanDgtl
pushed a commit
to HoomanDigital/tokenjam
that referenced
this pull request
Jun 20, 2026
…repo) `.tj/config.toml` was committed at v0.2.0 (a9173b8) and has been tracked through every release since. The file contains a real `ingest_secret` that is publicly readable in the git repo (not in the PyPI wheel — `packages = ["tokenjam"]` excludes the workspace directory, but the git exposure is the issue). `.gitignore:43` already lists `.tj/` — that rule didn't retroactively untrack the already-committed file. This removes the file from the index while keeping the local working copy so existing installs keep running. ## Blast radius The leaked value is an `ingest_secret`, the bearer token that protects `POST /api/v1/spans` on a local `tj serve`. It's per-install, network-only. Worst case: someone on the same network as a daemon configured with this exact secret could push fabricated spans to that daemon. There's no data-exfil path; the secret doesn't unlock anything beyond span ingest. ## What this PR does - `git rm --cached .tj/config.toml` (file removed from index, kept locally) - Future `git clone` will not carry the file → `tj onboard` works on fresh clones again ## What this PR does NOT do - The secret remains in git history and in published tags (v0.2.0 through v0.3.5). Rewriting that history would invalidate every release tag and break every fork; the cost outweighs the benefit given the limited blast radius above. - This is not a CVE. The secret was the project author's local dev install secret, not a customer credential. ## Action required of anyone who reused this secret If you happened to copy the committed config (unlikely but possible), generate a fresh value: `python3 -c "import secrets; print(secrets.token_hex(32))"` and update your local `~/.config/tj/config.toml` and `.tj/config.toml`. Reported by @ashwmu in Metabuilder-Labs#141 (finding Metabuilder-Labs#6). Co-Authored-By: ashwmu <[email protected]> Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
HoomanDgtl
pushed a commit
to HoomanDigital/tokenjam
that referenced
this pull request
Jun 20, 2026
Two prevention measures distilled from this week's repeated near-misses: 1. CLAUDE.md gets a new "Working with concurrent agents" section right after Build & Development. It explains the worktree pattern, the collision symptom (a commit on a branch you didn't intend, caused by another agent's HEAD being the checked-out one), and the safe recovery (rebase off, don't force-push). 2. New Critical Rule 20 documenting that `.tj/config.toml` is untracked and must stay that way (live per-install ingest_secret, regenerated at runtime). 3. New CI test `tests/unit/test_no_tracked_dev_secrets.py` that fails loud with a fix command if anyone re-stages `.tj/config.toml`. Cheap guard against the v0.2.0 → v0.3.5 leak (PR Metabuilder-Labs#145 + issue Metabuilder-Labs#141 finding Metabuilder-Labs#6) recurring. Reported by @ashwmu in Metabuilder-Labs#141 finding Metabuilder-Labs#6. The collision pattern surfaced across the Lens UI work, the Reuse analyzer, and the Metabuilder-Labs#141 triage — see the "Working with concurrent agents" section for the recovery playbook. Co-Authored-By: ashwmu <[email protected]> Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
anilmurty
pushed a commit
that referenced
this pull request
Jul 2, 2026
Distribution research (adoption.md) is blunt: 15-second-TTFV `npx` tools dramatically out-adopt 2-minute-install tools, and every high-star CLI in this niche has sub-30s time-to-first-value. TokenJam's `pipx install` + launchd/systemd daemon + onboarding is great for power users but measurably higher friction than `npx ccusage` for the Claude Code crowd — who reach for `npx` first and whose JSONL tj reads is the very same file ccusage parses. This ships a no-setup first-run path so a user with zero prior setup runs ONE command and sees where their Claude Code quota actually goes in well under 30s. - `tj quickstart` (cmd_quickstart.py): opens a transient InMemoryBackend (nothing written to ~/.tj, no config read/written, no daemon started or contacted), backfills ~/.claude/projects/*.jsonl into it, then renders quota composition (reusing #4's context_diagnostic engine) + a session timeline (new core/session_timeline.py). Output leads with ccusage-parity framing. Registered in `no_db_commands` so the CLI never opens the on-disk DB / trips the daemon lock for it. - Bare `tj` (no subcommand) routes to quickstart — the group is now `invoke_without_command=True`, so `uvx --from tokenjam tj` is one command. `--help`/`--version` are eager and still short-circuit. - `npm-wrapper/`: a dependency-free npm package named `tj` so `npx tj` works — a thin launcher that shells out to the Python CLI via the first available runner (uvx -> pipx run -> installed tj) and passes args through. NOT published here (build + document only). - Docs: README + docs/installation.md lead with `npx tj` / `uvx --from tokenjam tj` as the primary starting point; `tj onboard` stays the opt-in "go deeper" (daemon/MCP/live) path. Honesty discipline (Rule 14) preserved: every figure is a measured token share re-derived from the JSONL, never a projected saving. Tests: tests/unit/test_quickstart.py covers the timeline core, the CLI render, the JSON output, the no-logs branch, and that quickstart + bare `tj` never open the on-disk DB (open_db patched to raise). Validated with `make all` — ruff + mypy clean, full suite 1171 passed. `uvx --from <repo> tj` and the npm wrapper passthrough were exercised locally end-to-end. Co-Authored-By: Claude Opus 4.8 <[email protected]>
anilmurty
pushed a commit
that referenced
this pull request
Jul 2, 2026
The zero-install first run (`tj quickstart` / bare `tj`) backfills ~/.claude/projects/*.jsonl into a transient in-memory DB before printing the headline. Profiling a 3000-session synthetic history showed the backfill dominates (99.7s) while the diagnostic (0.45s) and timeline (0.04s) are trivial — the cost is the per-span SELECT+INSERT round-trips in `_insert_session_idempotent` (120k spans => 240k DuckDB statements). A first run over a large history blew well past the <30s time-to-first- value goal #6 targets. Add a most-recent-N-sessions cap to the first-run path: `iter_claude_code_ sessions` gains an optional `max_sessions` that walks files mtime-desc and stops once the cap is reached, bounding both parse and insert work regardless of how large ~/.claude is. `ingest_claude_code` threads it through and sets `BackfillResult.limit_reached`. `cmd_quickstart` caps at the most-recent 300 sessions by default (≈9s even on an 8000-session history), exposes `--full` to lift the cap, and discloses the truncation honestly ("Showing your most-recent N sessions … run tj quickstart --full or tj context for your full history") so it never reads as "this is everything". The full `tj backfill claude-code` path passes no cap and is byte-for-byte unchanged. Tests assert BOUNDED WORK (only N sessions/rows ingested on a large synthetic history, the cap keeps the freshest sessions, the limit flag and CLI disclosure render) rather than a flaky wall-clock number. Co-Authored-By: Claude <[email protected]>
anilmurty
pushed a commit
that referenced
this pull request
Jul 2, 2026
Real Claude Code backfills carry the current Anthropic model ids, but `claude-fable-5` and `claude-sonnet-4-5` had no entry in the packaged pricing table. `get_rates` returned None for them, so `calculate_cost` fell back to the $0.50/$2.00-per-MTok default and logged a "No pricing data" warning — silently mis-pricing the secondary API-plan "implied value / calibration" dollar line in `tj context`, `tj quota-audit`, and `tj tokenmaxx`. Surfaced while building #6. Add both entries with the published per-MTok rates (https://platform.claude.com/docs/en/pricing): - claude-fable-5: input 10.00 / output 50.00 / cache-read 1.00 / cache-write(5m) 12.50 - claude-sonnet-4-5: input 3.00 / output 15.00 / cache-read 0.30 / cache-write(5m) 3.75 (same published tier as Sonnet 4.6) The other current ids the backfill warns about — claude-opus-4-8, claude-sonnet-4-6, claude-haiku-4-5 — were already present. Extend tests/unit/test_pricing_override.py to assert each current Anthropic model resolves to its packaged rate, that none falls through to the default fallback, and that the dated YYYYMMDD variant resolves via the existing suffix-strip path. Co-Authored-By: Claude <[email protected]> (cherry picked from commit 0d16227)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
16 runnable examples across 4 tiers:
Also updates README.md (Examples section), CLAUDE.md (repo layout + rule 13 for PyPI package name), and adds the task spec.
Checklist
pytest tests/unit/ tests/synthetic/ tests/agents/ tests/integration/)ruff check ocw/)mypy ocw/)tests/factories.py(not rawNormalizedSpan)