Repository navigation
feat: wake 1.0 — Rust hook collector sending skill telemetry over OTLP - #101
Closed
moraisjose wants to merge 39 commits into
Closed
moraisjose wants to merge 39 commits into
moraisjose wants to merge 39 commits into
Conversation
…telemetry over OTLP Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Handle background subagents (async_launched, closed by task-notification), allow '_' in the token allowlist, pass session_id to derive, tighten slash-command detection, flush open invocations of sessions that never got SessionEnd, keep APM-installed hooks out of wake install/uninstall, and add Langfuse JSON and upsert checks. Spec drops StopFailure, sends MCP aggregates per turn, and simplifies the inventory entry format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fig files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds langfuse.observation.type=generation on spans carrying a model or tokens, so Langfuse prices them (plan Task 5 table and spec 5.6 updated). Docs: https://langfuse.com/integrations/native/opentelemetry https://langfuse.com/docs/opentelemetry/get-started Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fields only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…use in either order Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tions Foreground Agent results close a Subagent invocation at once; background ones wait in state.pending_agents for their task-notification or session end. MCP tool_uses aggregate per (server, tool, enclosing skill) per derive call. Non-skill slash commands become Command events. Adds the subagent_transcript path helper. Also folds in ruling R15: a command moves the interrupt turn start and ends other invocations' slash-merge window, an invocation no longer counts its own start Skill tool_use, and close() builds by OpenInvocation.kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…agent transcripts Subagent span keys include the launching Agent tool_use id, so a continued subagent (same agentId) gets a distinct span. Background agents without a tool_use id are not kept, and empty notification ids match nothing. SessionState.root_parent_key (R17) parents skills, subagents, MCP aggregates and commands that have no enclosing skill. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iles Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…v2 docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e pins Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…age entries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uses it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…skills, and carry the model R29: a subagent span's tokens are its transcript total minus the tokens of the skill invocations derived from that same transcript (both requestId-deduped, so disjoint), and its gen_ai.request.model is the model of the transcript's last assistant entry with usage, so Langfuse can price it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… are both idle R27 (amends R18): SessionState saves the transcript path on every hook run. The stale flush needs the state file and the transcript (when known and present) both untouched for 30 minutes, so a long single turn or a long background subagent in another live session is no longer closed early. Subagents closed by the stale flush are followed into their own transcripts with the R16/R29 token and model logic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R28: queued payloads are merged 50 at a time into one ExportTraceServiceRequest (their resourceSpans concatenated), no POST starts once the flush has run 5 s, and the outbox is rewritten after each batch that succeeds or is rejected for good, so a kill mid-flush keeps the progress made. The first transient failure still ends the flush. A queued body that is not OTLP is sent on its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R30: the outbox lock and the outbox writer created the state dir with the default umask, and the outbox and its tmp file were 0644 although they hold encoded spans (user email, repo). Every state directory is now created 0700 and the outbox is written through a fresh 0600 tmp file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SECURITY.md still described v1 (consent tables, wake remote, doctor, the loopback dashboard, no outbound spool, HMAC repo identity). It now covers what v2 sends (the spec 5.6 allowlist, wake.repo in clear, email or salted pseudonym), what stays local (0600 config with credentials, 0700 state dir, 0600 outbox of queued spans), install never touching hooks it does not own, wake check never printing secrets, and the Langfuse key caveat (spec 5.8). The reporting channel is unchanged. wake --version / -V prints "wake <version>", as the report template asks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…shing The launcher exits 0 without running anything when the binary it picks is not executable, so a package committed without the exec bit installs cleanly and silently sends nothing. The template README now has the chmod +x and git update-index --chmod=+x step, and how to check for mode 100755. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R30: a new version job compares the pushed tag (without its leading v) with the crate version from cargo metadata, and every build job needs it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… comment fixes R30: the README now lists the per-repo .claude/settings.local.json env level for WAKE_DISABLED (spec 5.2), documents $XDG_CONFIG_HOME/wake/config.json, and explains identity_salt (anonymous mode sends no user without it). CONTRIBUTING places the hook enum in harness/claude_code/mod.rs, and the transcript reader's header says prompt text is read transiently and never retained or sent, rather than never held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
R30: trace_id("s1") and span_id("k1") are pinned to hex computed
independently with shasum, so a change to the id derivation (which would re-key
every span already stored in a backend) fails a test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…otes R30: the hook command is "<exe>" emit <event>, run by a shell. A path containing ", $, a backtick or a backslash would break out of or be expanded inside those quotes, so install now refuses it with InstallError::UnsafeExePath and a clear message, before writing anything. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…from public_key/secret_key Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude Code's transcript input_tokens excludes cached tokens, while the OTel GenAI semconv (and Langfuse) treat gen_ai.usage.input_tokens as the total and subtract the cache fields from it. Verified against Langfuse Cloud: input 10 + cache 52,000 was recorded as input 0; sending the total (52,010) records input 10 and prices it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 of 8 tasks
Collaborator
Author
|
Superseded by 102 after renaming the branch from |
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
Wake 1.0 replaces the Go 0.x (local per-developer reports, consent machinery, full transcript rescans) with a small Rust binary that Claude Code hooks call asynchronously. Each
SessionStart/Stop/SessionEndreads only the new slice of the transcript. It derives one event per skill, subagent, MCP tool (aggregated) or slash command, and sends them as OTLP/HTTP JSON spans to a configured endpoint, Langfuse first.docs/superpowers/specs/2026-11-26-wake-v2-design.mddocs/superpowers/plans/2026-11-26-wake-v2-claude-code.mdWhat's in it
wake emit: incremental transcript reader that keeps allowlisted fields only. Skill windows come from the harness's ownattributionSkill. Subagents are handled both foreground and background (background ones are closed by their<task-notification>). Subagent transcripts are followed up to depth 3, and tokens are never counted twice.gen_ai.*token and model fields so Langfuse prices them, and deterministic span ids. The order is enqueue, then save state, then one flush per run, with a bounded outbox (1,000 entries / 7 days; batches of 50; 5 s deadline).wake check: prints the resolved config without secrets and sends a test event.wake install/wake uninstall [--purge]: merges three async hook groups into~/.claude/settings.jsonand removes them again. It never touches APM-installed hooks, refuses files it can't parse safely, and the install + uninstall round trip is byte-identical.install.sh(checksum-verified), a GitHub Releases workflow (4 targets, ≤ 2 MB each, tag must match the crate version), and an APM package template underpackage/.SECURITY.mdand CONTRIBUTING rewritten for 1.0, plusdocs/langfuse-setup.md.v1 is tagged locally as
v1-final. That tag is not pushed yet.Test plan
cargo fmt --check,cargo clippy --all-targets -- -D warnings: cleancargo test: 179 passed, 0 failed (perf test ignored in the default run, run separately in CI)wake install→check→uninstall --purgeon a copy of a realsettings.json: byte-identicalgen_ai.*, and upsert of a resent span idrelease.yml(e.g. av1.0.0-rc.1tag, after bumpingCargo.toml)Known follow-ups
<synthetic>last model yields no model on a subagent span.🤖 Generated with Claude Code